-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Alexey Gurianov
committed
Jun 22, 2015
1 parent
a0b0bed
commit 28f1b3f
Showing
5 changed files
with
106 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"bitwise": true, | ||
"eqeqeq": true, | ||
"forin": true, | ||
"freeze": true, | ||
"immed": true, | ||
"latedef": "nofunc", | ||
"noarg": true, | ||
"noempty": true, | ||
"nonbsp": true, | ||
"nonew": true, | ||
"undef": true, | ||
"unused": true, | ||
"node": true, | ||
"mocha": true, | ||
"expr": true, | ||
"sub": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
test/**/*.test.js | ||
--ui bdd | ||
--reporter dot | ||
--require must |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
var mock = require('mock-fs'), | ||
MockNode = require('mock-enb/lib/mock-node'), | ||
ngAnnotate = require('../../techs/ng-annotate'); | ||
|
||
describe('ng-annotate', function () { | ||
var bundle; | ||
|
||
afterEach(function () { | ||
mock.restore(); | ||
}); | ||
|
||
it('must apply ng-annotate module', function () { | ||
mock({ | ||
blocks: {}, | ||
bundle: { | ||
'bundle.pre.js': 'angular.module("MyMod").controller("MyCtrl", function(dep1, dep2) {});' | ||
} | ||
}); | ||
|
||
bundle = new MockNode('bundle'); | ||
|
||
var reference = 'angular.module("MyMod").controller("MyCtrl", ["dep1", "dep2", function(dep1, dep2) {}]);'; | ||
|
||
return bundle.runTechAndGetContent(ngAnnotate, { source: 'bundle.pre.js' }) | ||
.spread(function (content) { | ||
content.toString().must.be(reference); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
var EOL = require('os').EOL, | ||
mock = require('mock-fs'), | ||
FileList = require('enb/lib/file-list'), | ||
MockNode = require('mock-enb/lib/mock-node'), | ||
ngTemplates = require('../../techs/ng-templates'); | ||
|
||
describe('ng-templates', function () { | ||
var bundle, | ||
fileList; | ||
|
||
afterEach(function () { | ||
mock.restore(); | ||
}); | ||
|
||
it('must wrap file content with script tag and use filename as id', function () { | ||
mock({ | ||
blocks: { | ||
'block0.tmpl.html': 'Hello0', | ||
'block1.tmpl.html': 'Hello1' | ||
}, | ||
bundle: {} | ||
}); | ||
|
||
bundle = new MockNode('bundle'); | ||
fileList = new FileList(); | ||
|
||
fileList.loadFromDirSync('blocks'); | ||
|
||
bundle.provideTechData('?.files', fileList); | ||
|
||
var reference = [ | ||
'<script type="text/ng-template" id="block0.tmpl.html">', | ||
'Hello0', | ||
'</script>', | ||
'<script type="text/ng-template" id="block1.tmpl.html">', | ||
'Hello1', | ||
'</script>' | ||
].join(EOL); | ||
|
||
return bundle.runTechAndGetContent(ngTemplates) | ||
.spread(function (content) { | ||
content.toString().must.be(reference); | ||
}); | ||
}); | ||
}); |