Skip to content

Commit 6fe22dc

Browse files
committed
Use karma-ng-html2js-preprocessor
1 parent 1145041 commit 6fe22dc

File tree

5 files changed

+19
-2
lines changed

5 files changed

+19
-2
lines changed

app/main/mainDirective.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
angular.module('mainModule')
44
.directive('mainDirective', function () {
55
return {
6-
template: '<h1>{{greeting}}</h1>'
7-
// templateUrl: 'main/mainView.html'
6+
// template: '<h1>{{greeting}}</h1>'
7+
templateUrl: 'main/mainView.html'
88
};
99
}
1010
);

karma.conf.js

+9
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ module.exports = function(config) {
44

55
basePath: '.',
66

7+
ngHtml2JsPreprocessor: {
8+
stripPrefix: 'app/'
9+
},
10+
711
files: [
812
'app/lib/jquery/dist/jquery.js',
913
'app/lib/angular/angular.js',
@@ -22,13 +26,18 @@ module.exports = function(config) {
2226
'app/main/mainComponent.js',
2327
'app/app.js',
2428
'app/appConfig.js',
29+
'app/main/mainView.html',
2530
'test/**/*Spec.js'
2631
],
2732

2833
exclude: [
2934
'**/*~'
3035
],
3136

37+
preprocessors: {
38+
'app/main/mainView.html': ['ng-html2js']
39+
},
40+
3241
frameworks: ['jasmine'],
3342

3443
browsers: [

package-lock.json

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"karma-firefox-launcher": "^0.1.7",
2424
"karma-jasmine": "^0.2.3",
2525
"karma-junit-reporter": "^0.4.2",
26+
"karma-ng-html2js-preprocessor": "^1.0.0",
2627
"karma-phantomjs-launcher": "^1.0.3",
2728
"path": "^0.12.7",
2829
"phantomjs-prebuilt": "^2.1.16",

test/main/mainDirectiveSpec.js

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
describe('mainDirective', function() {
44

55
beforeEach(module('mainModule'));
6+
beforeEach(module('main/mainView.html'));
67

78
var element;
89
var scope;

0 commit comments

Comments
 (0)