Skip to content

Commit

Permalink
Add test for prepend
Browse files Browse the repository at this point in the history
  • Loading branch information
ericclemmons committed Mar 27, 2013
1 parent e4615d2 commit a840f22
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
8 changes: 8 additions & 0 deletions Gruntfile.js
Expand Up @@ -50,6 +50,14 @@ module.exports = function(grunt) {
},
src: ['test/fixtures/simple.html'],
dest: 'tmp/simple.js'
},
prepend: {
options: {
base: 'test/fixtures',
prepend: '/prepend/'
},
src: ['test/fixtures/simple.html'],
dest: 'tmp/simple_prepend.js'
}
}
});
Expand Down
14 changes: 12 additions & 2 deletions test/angular-templates_test.js
Expand Up @@ -11,7 +11,7 @@ exports.ngtemplates = {
var actual = grunt.file.read('tmp/simple.js');
var expected = grunt.file.read('test/expected/simple.js');

test.equal(expected, actual, 'should compile template as module `simple.templates`');
test.equal(expected, actual, 'should compile template as module `simple`');
test.done();
},

Expand All @@ -21,7 +21,17 @@ exports.ngtemplates = {
var actual = grunt.file.read('tmp/multiple.js');
var expected = grunt.file.read('test/expected/multiple.js');

test.equal(expected, actual, 'should compile multiple templates together as `multiple.templates`');
test.equal(expected, actual, 'should compile multiple templates together as `multiple`');
test.done();
},

prepend: function(test) {
test.expect(1);

var actual = grunt.file.read('tmp/simple_prepend.js');
var expected = grunt.file.read('test/expected/simple_prepend.js');

test.equal(expected, actual, 'should prepend $templateCache ID with /prepend/simple.html"');
test.done();
}

Expand Down
8 changes: 8 additions & 0 deletions test/expected/simple_prepend.js
@@ -0,0 +1,8 @@
angular.module("prepend").run(["$templateCache", function($templateCache) {

$templateCache.put("/prepend/simple.html",
"Howdy there! \\ Your name is \"{{ name }}\"." +
""
);

}]);

0 comments on commit a840f22

Please sign in to comment.