Browse Source

Add really dumb directive spec

Lily Carpenter 10 years ago
parent
commit
978026b518
3 changed files with 30 additions and 1 deletions
  1. 6 0
      karma.conf.js
  2. 3 1
      package.json
  3. 21 0
      tests/noteDirectiveSpec.js

+ 6 - 0
karma.conf.js

19
       'www/lib/angular-mocks/angular-mocks.js',
19
       'www/lib/angular-mocks/angular-mocks.js',
20
       'www/lib/angular-route/angular-route.js',
20
       'www/lib/angular-route/angular-route.js',
21
       'www/js/**/*.js',
21
       'www/js/**/*.js',
22
+      'www/partials/*.html',
22
       'tests/**/*.js'
23
       'tests/**/*.js'
23
     ],
24
     ],
24
 
25
 
31
     // preprocess matching files before serving them to the browser
32
     // preprocess matching files before serving them to the browser
32
     // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
33
     // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
33
     preprocessors: {
34
     preprocessors: {
35
+      'www/partials/*.html': 'ng-html2js'
34
     },
36
     },
35
 
37
 
38
+    ngHtml2JsPreprocessor: {
39
+      stripPrefix: 'www/',
40
+      moduleName: 'bootcampAppPartials'
41
+    },
36
 
42
 
37
     // test results reporter to use
43
     // test results reporter to use
38
     // possible values: 'dots', 'progress'
44
     // possible values: 'dots', 'progress'

+ 3 - 1
package.json

22
     "gulp-connect": "^2.2.0",
22
     "gulp-connect": "^2.2.0",
23
     "gulp-plumber": "^0.6.6",
23
     "gulp-plumber": "^0.6.6",
24
     "gulp-watch": "^1.1.0",
24
     "gulp-watch": "^1.1.0",
25
-    "karma": "^0.12.24"
25
+    "karma": "^0.12.24",
26
+    "karma-ng-html2js-preprocessor": "^0.1.2",
27
+    "ng-html2js": "^2.0.0"
26
   },
28
   },
27
   "devDependencies": {
29
   "devDependencies": {
28
     "karma-chrome-launcher": "^0.1.5",
30
     "karma-chrome-launcher": "^0.1.5",

+ 21 - 0
tests/noteDirectiveSpec.js

1
+(function(){
2
+  'use strict';
3
+
4
+  var element, parentScope;
5
+  describe('note', function(){
6
+    beforeEach(function(){
7
+      module("bootcampApp");
8
+      module("bootcampAppPartials");
9
+      element = angular.element('<note></note>');
10
+
11
+
12
+      inject(function($rootScope){parentScope = $rootScope.$new();});
13
+      inject(function($compile) {$compile(element)(parentScope);});
14
+      parentScope.$digest();
15
+    });
16
+
17
+    it('has string Created:', function(){
18
+      expect(angular.element(element).html()).toContain('createdDate');
19
+    });
20
+  });
21
+})();