Skip to content

Commit

Permalink
AngularJS Service and Test Spec
Browse files Browse the repository at this point in the history
  • Loading branch information
johnpapa committed Sep 3, 2014
1 parent fad42e4 commit cfcd705
Show file tree
Hide file tree
Showing 27 changed files with 166 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<TemplateData>
<DefaultName>controller.js</DefaultName>
<Name>AngularJs Controller using 'Controller as'</Name>
<Description>AngularJs Controller: minification ready, starter dependencies, using 'Controller As' syntax. By John Papa, http://johnpapa.net</Description>
<Description>AngularJs Controller: minification ready, starter dependencies, using 'Controller As' syntax. By John Papa, http://twitter.com/john_papa</Description>
<ProjectType>CSharp</ProjectType>
<Icon>icon.png</Icon>
<NumberOfParentCategoriesToRollUp>1</NumberOfParentCategoriesToRollUp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<TemplateData>
<DefaultName>controller.js</DefaultName>
<Name>AngularJs Controller using 'Controller as'</Name>
<Description>AngularJs Controller: minification ready, starter dependencies, using 'Controller As' syntax. By John Papa, http://johnpapa.net</Description>
<Description>AngularJs Controller: minification ready, starter dependencies, using 'Controller As' syntax. By John Papa, http://twitter.com/john_papa</Description>
<ProjectType>VisualBasic</ProjectType>
<Icon>icon.png</Icon>
<NumberOfParentCategoriesToRollUp>1</NumberOfParentCategoriesToRollUp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<TemplateData>
<DefaultName>controller.js</DefaultName>
<Name>AngularJs Controller using 'Controller as'</Name>
<Description>AngularJs Controller: minification ready, starter dependencies, using 'Controller As' syntax. By John Papa, http://johnpapa.net</Description>
<Description>AngularJs Controller: minification ready, starter dependencies, using 'Controller As' syntax. By John Papa, http://twitter.com/john_papa</Description>
<ProjectType>Web</ProjectType>
<ProjectSubType>CSharp</ProjectSubType>
<Icon>icon.png</Icon>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<TemplateData>
<DefaultName>controller.js</DefaultName>
<Name>AngularJs Controller using $scope</Name>
<Description>AngularJs Controller $scope: minification ready, starter dependencies, using 'Classic' $scope syntax. By John Papa, http://johnpapa.net</Description>
<Description>AngularJs Controller $scope: minification ready, starter dependencies, using 'Classic' $scope syntax. By John Papa, http://twitter.com/john_papa</Description>
<ProjectType>CSharp</ProjectType>
<Icon>icon.png</Icon>
<NumberOfParentCategoriesToRollUp>1</NumberOfParentCategoriesToRollUp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<TemplateData>
<DefaultName>controller.js</DefaultName>
<Name>AngularJs Controller using $scope</Name>
<Description>AngularJs Controller $scope: minification ready, starter dependencies, using 'Classic' $scope syntax. By John Papa, http://johnpapa.net</Description>
<Description>AngularJs Controller $scope: minification ready, starter dependencies, using 'Classic' $scope syntax. By John Papa, http://twitter.com/john_papa</Description>
<ProjectType>VisualBasic</ProjectType>
<Icon>icon.png</Icon>
<NumberOfParentCategoriesToRollUp>1</NumberOfParentCategoriesToRollUp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<TemplateData>
<DefaultName>controller.js</DefaultName>
<Name>AngularJs Controller using $scope</Name>
<Description>AngularJs Controller $scope: minification ready, starter dependencies, using 'Classic' $scope syntax. By John Papa, http://johnpapa.net</Description>
<Description>AngularJs Controller $scope: minification ready, starter dependencies, using 'Classic' $scope syntax. By John Papa, http://twitter.com/john_papa</Description>
<ProjectType>Web</ProjectType>
<ProjectSubType>CSharp</ProjectSubType>
<Icon>icon.png</Icon>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<TemplateData>
<DefaultName>directive.js</DefaultName>
<Name>AngularJs Directive</Name>
<Description>AngularJs Directive: minification ready and starter dependencies. By John Papa, http://johnpapa.net</Description>
<Description>AngularJs Directive: minification ready and starter dependencies. By John Papa, http://twitter.com/john_papa</Description>
<ProjectType>CSharp</ProjectType>
<Icon>icon.png</Icon>
<NumberOfParentCategoriesToRollUp>1</NumberOfParentCategoriesToRollUp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<TemplateData>
<DefaultName>directive.js</DefaultName>
<Name>AngularJs Directive</Name>
<Description>AngularJs Directive: minification ready and starter dependencies. By John Papa, http://johnpapa.net</Description>
<Description>AngularJs Directive: minification ready and starter dependencies. By John Papa, http://twitter.com/john_papa</Description>
<ProjectType>VisualBasic</ProjectType>
<Icon>icon.png</Icon>
<NumberOfParentCategoriesToRollUp>1</NumberOfParentCategoriesToRollUp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<TemplateData>
<DefaultName>directive.js</DefaultName>
<Name>AngularJs Directive</Name>
<Description>AngularJs Directive: minification ready and starter dependencies. By John Papa, http://johnpapa.net</Description>
<Description>AngularJs Directive: minification ready and starter dependencies. By John Papa, http://twitter.com/john_papa</Description>
<ProjectType>Web</ProjectType>
<ProjectSubType>CSharp</ProjectSubType>
<Icon>icon.png</Icon>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

function $safeitemname$ ($window) {
// Usage:

This comment has been minimized.

Copy link
@bbodenmiller

bbodenmiller Jun 15, 2015

Contributor

@johnpapa is the comment style here or at https://github.com/johnpapa/angular-styleguide#directives better? If https://github.com/johnpapa/angular-styleguide#directives is better I'll submit a PR to change this file.

//
// <$safeitemname$></$safeitemname$>
// Creates:
//
var directive = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<TemplateData>
<DefaultName>factory.js</DefaultName>
<Name>AngularJs Factory</Name>
<Description>AngularJs Factory: minification ready with starter dependencies. By John Papa, http://johnpapa.net</Description>
<Description>AngularJs Factory: minification ready with starter dependencies. By John Papa, http://twitter.com/john_papa</Description>
<ProjectType>CSharp</ProjectType>
<Icon>icon.png</Icon>
<NumberOfParentCategoriesToRollUp>1</NumberOfParentCategoriesToRollUp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<TemplateData>
<DefaultName>factory.js</DefaultName>
<Name>AngularJs Factory</Name>
<Description>AngularJs Factory: minification ready with starter dependencies. By John Papa, http://johnpapa.net</Description>
<Description>AngularJs Factory: minification ready with starter dependencies. By John Papa, http://twitter.com/john_papa</Description>
<ProjectType>VisualBasic</ProjectType>
<Icon>icon.png</Icon>
<NumberOfParentCategoriesToRollUp>1</NumberOfParentCategoriesToRollUp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<TemplateData>
<DefaultName>factory.js</DefaultName>
<Name>AngularJs Factory</Name>
<Description>AngularJs Factory: minification ready with starter dependencies. By John Papa, http://johnpapa.net</Description>
<Description>AngularJs Factory: minification ready with starter dependencies. By John Papa, http://twitter.com/john_papa</Description>
<ProjectType>Web</ProjectType>
<ProjectSubType>CSharp</ProjectSubType>
<Icon>icon.png</Icon>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<VSTemplate Version="3.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" Type="Item">
<TemplateData>
<DefaultName>service.js</DefaultName>
<Name>AngularJs Service</Name>
<Description>AngularJs Service: minification ready with starter dependencies. By John Papa, http://twitter.com/john_papa</Description>
<ProjectType>CSharp</ProjectType>
<Icon>icon.png</Icon>
<NumberOfParentCategoriesToRollUp>1</NumberOfParentCategoriesToRollUp>
</TemplateData>
<TemplateContent>
<References />
<ProjectItem ReplaceParameters="true">service.js</ProjectItem>
</TemplateContent>
</VSTemplate>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<VSTemplate Version="3.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" Type="Item">
<TemplateData>
<DefaultName>service.js</DefaultName>
<Name>AngularJs Service</Name>
<Description>AngularJs Service: minification ready with starter dependencies. By John Papa, http://twitter.com/john_papa</Description>
<ProjectType>VisualBasic</ProjectType>
<Icon>icon.png</Icon>
<NumberOfParentCategoriesToRollUp>1</NumberOfParentCategoriesToRollUp>
</TemplateData>
<TemplateContent>
<References />
<ProjectItem ReplaceParameters="true">service.js</ProjectItem>
</TemplateContent>
</VSTemplate>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<VSTemplate Version="3.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" Type="Item">
<TemplateData>
<DefaultName>service.js</DefaultName>
<Name>AngularJs Service</Name>
<Description>AngularJs Service: minification ready with starter dependencies. By John Papa, http://twitter.com/john_papa</Description>
<ProjectType>Web</ProjectType>
<ProjectSubType>CSharp</ProjectSubType>
<Icon>icon.png</Icon>
<NumberOfParentCategoriesToRollUp>1</NumberOfParentCategoriesToRollUp>
</TemplateData>
<TemplateContent>
<References />
<ProjectItem ReplaceParameters="true">service.js</ProjectItem>
</TemplateContent>
</VSTemplate>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
(function () {
'use strict';

angular
.module('app')
.service('$safeitemname$', $safeitemname$);

$safeitemname$.$inject = ['$http'];

function $safeitemname$($http) {
this.getData = getData;

function getData() { }
}
})();
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<VSTemplate Version="3.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" Type="Item">
<TemplateData>
<DefaultName>spec.js</DefaultName>
<Name>AngularJs Test Spec</Name>
<Description>AngularJs Test Spec. By John Papa, http://twitter.com/john_papa </Description>
<ProjectType>CSharp</ProjectType>
<Icon>icon.png</Icon>
<NumberOfParentCategoriesToRollUp>1</NumberOfParentCategoriesToRollUp>
</TemplateData>
<TemplateContent>
<References />
<ProjectItem ReplaceParameters="true">spec.js</ProjectItem>
</TemplateContent>
</VSTemplate>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<VSTemplate Version="3.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" Type="Item">
<TemplateData>
<DefaultName>spec.js</DefaultName>
<Name>AngularJs Test Spec</Name>
<Description>AngularJs Test Spec. By John Papa, http://twitter.com/john_papa</Description>
<ProjectType>VisualBasic</ProjectType>
<Icon>icon.png</Icon>
<NumberOfParentCategoriesToRollUp>1</NumberOfParentCategoriesToRollUp>
</TemplateData>
<TemplateContent>
<References />
<ProjectItem ReplaceParameters="true">spec.js</ProjectItem>
</TemplateContent>
</VSTemplate>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<VSTemplate Version="3.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" Type="Item">
<TemplateData>
<DefaultName>spec.js</DefaultName>
<Name>AngularJs Test Spec</Name>
<Description>AngularJs Test Spec. By John Papa, http://twitter.com/john_papa</Description>
<ProjectType>Web</ProjectType>
<ProjectSubType>CSharp</ProjectSubType>
<Icon>icon.png</Icon>
<NumberOfParentCategoriesToRollUp>1</NumberOfParentCategoriesToRollUp>
</TemplateData>
<TemplateContent>
<References />
<ProjectItem ReplaceParameters="true">spec.js</ProjectItem>
</TemplateContent>
</VSTemplate>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions TemplatePack/ItemTemplates/Web/JavaScript/AngularJs/Test/spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
describe('$safeitemname$', function () {
var $controller,
$httpBackend,
$rootScope;

beforeEach(function () {
module('app');
inject(function (_$controller_, _$httpBackend_, _$rootScope_) {
$controller = _$controller_;
$httpBackend = _$httpBackend_;
$rootScope = _$rootScope_;
});
});

it('should exist', function () {
//TODO: expectation goes here
});
});
20 changes: 15 additions & 5 deletions TemplatePack/TemplatePack.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,16 @@
<Content Include="ItemTemplates\Extensibility\BrowserLink\_Definitions\CSharp.vstemplate" />
<Content Include="ItemTemplates\Extensibility\JsonSchemaSelector\icon.png" />
<Content Include="ItemTemplates\Extensibility\JsonSchemaSelector\_Definitions\CSharp.vstemplate" />
<Content Include="ItemTemplates\Web\JavaScript\AngularJs\Service\icon.png" />
<Content Include="ItemTemplates\Web\JavaScript\AngularJs\Service\service.js" />
<Content Include="ItemTemplates\Web\JavaScript\AngularJs\Service\_Definitions\CSharp.vstemplate" />
<Content Include="ItemTemplates\Web\JavaScript\AngularJs\Service\_Definitions\VB.vstemplate" />
<Content Include="ItemTemplates\Web\JavaScript\AngularJs\Service\_Definitions\Web.csharp.vstemplate" />
<Content Include="ItemTemplates\Web\JavaScript\AngularJs\Test\icon.png" />
<Content Include="ItemTemplates\Web\JavaScript\AngularJs\Test\spec.js" />
<Content Include="ItemTemplates\Web\JavaScript\AngularJs\Test\_Definitions\CSharp.vstemplate" />
<Content Include="ItemTemplates\Web\JavaScript\AngularJs\Test\_Definitions\VB.vstemplate" />
<Content Include="ItemTemplates\Web\JavaScript\AngularJs\Test\_Definitions\Web.csharp.vstemplate" />
<Content Include="ItemTemplates\Web\JavaScript\Mocha\icon.png" />
<Content Include="ItemTemplates\Web\JavaScript\Mocha\template.js" />
<Content Include="ItemTemplates\Web\JavaScript\Mocha\_Definitions\CSharp.vstemplate">
Expand Down Expand Up @@ -544,11 +554,11 @@
<Content Include="ItemTemplates\Web\JavaScript\AngularJs\Controller using %24scope\_Definitions\VB.vstemplate" />
<Content Include="ItemTemplates\Web\JavaScript\AngularJs\Controller using %24scope\_Definitions\Web.csharp.vstemplate" />
<Content Include="ItemTemplates\Web\JavaScript\AngularJs\Controller using %24scope\icon.png" />
<Content Include="ItemTemplates\Web\JavaScript\AngularJs\Controller\controller.js" />
<Content Include="ItemTemplates\Web\JavaScript\AngularJs\Controller\_Definitions\CSharp.vstemplate" />
<Content Include="ItemTemplates\Web\JavaScript\AngularJs\Controller\_Definitions\VB.vstemplate" />
<Content Include="ItemTemplates\Web\JavaScript\AngularJs\Controller\_Definitions\Web.csharp.vstemplate" />
<Content Include="ItemTemplates\Web\JavaScript\AngularJs\Controller\icon.png" />
<Content Include="ItemTemplates\Web\JavaScript\AngularJs\Controller As\controller.js" />
<Content Include="ItemTemplates\Web\JavaScript\AngularJs\Controller As\_Definitions\CSharp.vstemplate" />
<Content Include="ItemTemplates\Web\JavaScript\AngularJs\Controller As\_Definitions\VB.vstemplate" />
<Content Include="ItemTemplates\Web\JavaScript\AngularJs\Controller As\_Definitions\Web.csharp.vstemplate" />
<Content Include="ItemTemplates\Web\JavaScript\AngularJs\Controller As\icon.png" />
<Content Include="ItemTemplates\TypeScript\AngularJs\TypeScript Directive\_Definitions\CSharp.vstemplate" />
<Content Include="ItemTemplates\TypeScript\AngularJs\TypeScript Directive\_Definitions\VB.vstemplate" />
<Content Include="ItemTemplates\TypeScript\AngularJs\TypeScript Directive\_Definitions\Web.csharp.vstemplate" />
Expand Down
Loading

0 comments on commit cfcd705

Please sign in to comment.