Quellcode durchsuchen

Add really dumb directive spec

Lily Carpenter vor 10 Jahren
Ursprung
Commit
978026b518
3 geänderte Dateien mit 30 neuen und 1 gelöschten Zeilen
  1. 6 0
      karma.conf.js
  2. 3 1
      package.json
  3. 21 0
      tests/noteDirectiveSpec.js

+ 6 - 0
karma.conf.js

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

+ 3 - 1
package.json

@@ -22,7 +22,9 @@
22 22
     "gulp-connect": "^2.2.0",
23 23
     "gulp-plumber": "^0.6.6",
24 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 29
   "devDependencies": {
28 30
     "karma-chrome-launcher": "^0.1.5",

+ 21 - 0
tests/noteDirectiveSpec.js

@@ -0,0 +1,21 @@
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
+})();