Skip to content

Instantly share code, notes, and snippets.

@chrisjaure
Last active December 30, 2016 09:15
Show Gist options
  • Select an option

  • Save chrisjaure/6515906 to your computer and use it in GitHub Desktop.

Select an option

Save chrisjaure/6515906 to your computer and use it in GitHub Desktop.

Revisions

  1. chrisjaure revised this gist Dec 30, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion AngularJS Directive Test.sublime-snippet
    Original file line number Diff line number Diff line change
    @@ -19,7 +19,7 @@ describe('${1:SuiteName}', function() {
    scope = \$rootScope.\$new();
    \$compile(elm)(scope);
    scope.\$digest();
    // isolateScope = elm.scope();
    // isolateScope = elm.isolateScope();
    });
    });
  2. chrisjaure created this gist Sep 10, 2013.
    41 changes: 41 additions & 0 deletions AngularJS Controller Test.sublime-snippet
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,41 @@
    <snippet>
    <content><![CDATA[
    describe('${1:SuiteName}', function() {
    var scope, \$httpBackend, initController;
    beforeEach(function() {
    module('${2:ModuleName}', function(\$provide){
    });
    inject(function(\$injector) {
    var \$rootScope, \$controller;
    \$rootScope = \$injector.get('\$rootScope');
    \$controller = \$injector.get('\$controller');
    \$httpBackend = \$injector.get('\$httpBackend');
    scope = \$rootScope.\$new();
    initController = function(opts) {
    \$controller('${3:ControllerName}', angular.extend({
    \$scope: scope
    }, (opts || {})));
    };
    });
    });
    afterEach(function() {
    // \$httpBackend.verifyNoOutstandingExpectation();
    // \$httpBackend.verifyNoOutstandingRequest();
    scope.\$destroy();
    });
    it('should pass', function() {
    // \$httpBackend.expectGET('').respond(200);
    initController();
    });
    });
    ]]></content>
    <tabTrigger>ng:test:c</tabTrigger>
    <scope>source.js</scope>
    </snippet>
    38 changes: 38 additions & 0 deletions AngularJS Directive Test.sublime-snippet
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,38 @@
    <snippet>
    <content><![CDATA[
    describe('${1:SuiteName}', function() {
    var elm, scope, isolateScope,
    html = '${3:<div>Element Template</div>}';
    beforeEach(function() {
    module('${2:ModuleName}', function(\$provide){
    });
    inject(function(\$injector) {
    var \$compile, \$templateCache, \$rootScope;
    \$compile = \$injector.get('\$compile');
    \$rootScope = \$injector.get('\$rootScope');
    // \$templateCache = \$injector.get('\$templateCache');
    // \$templateCache.put('${4:templateUrl}', '<div></div>');
    elm = angular.element(html);
    scope = \$rootScope.\$new();
    \$compile(elm)(scope);
    scope.\$digest();
    // isolateScope = elm.scope();
    });
    });
    afterEach(function() {
    scope.\$destroy();
    });
    it('should pass', function() {
    });
    });
    ]]></content>
    <tabTrigger>ng:test:d</tabTrigger>
    <scope>source.js</scope>
    </snippet>
    31 changes: 31 additions & 0 deletions AngularJS Service Test.sublime-snippet
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,31 @@
    <snippet>
    <content><![CDATA[
    describe('${1:SuiteName}', function() {
    var ${3:ServiceName}, scope;
    beforeEach(function() {
    module('${2:ModuleName}', function(\$provide){
    });
    inject(function(\$injector) {
    var \$rootScope;
    \$rootScope = \$injector.get('\$rootScope');
    ${3:ServiceName} = \$injector.get('${3:ServiceName}');
    scope = \$rootScope.\$new();
    });
    });
    afterEach(function() {
    scope.\$destroy();
    });
    it('should pass', function() {
    });
    });
    ]]></content>
    <tabTrigger>ng:test:s</tabTrigger>
    <scope>source.js</scope>
    </snippet>