Fixed the tests for the AMD-no-Namespace improvement

format
Adrien Antoine 12 years ago
parent 4a4e1734bf
commit efee77f83c

@ -74,6 +74,18 @@ module.exports = function(grunt) {
"tmp/amd_wrapper.js": ["test/fixtures/template.html"]
}
},
amd_wrapper_no_ns: {
options: {
templateSettings: {
variable: 'obj'
},
amdWrapper:true,
namespace:false
},
files: {
"tmp/amd_wrapper_no_ns.js": ["test/fixtures/template.html"]
}
},
uglyfile: {
options: {
templateSettings: {

@ -83,7 +83,7 @@ module.exports = function(grunt) {
if (options.namespace !== false) {
// Namespace has not been explicitly set to false; the AMD
// wrapper will return the object containing the template.
output.push(" return " + nsInfo.namespace + ";" + lf);
output.push(" return " + nsInfo.namespace + ";");
}
output.push("});");
}

@ -11,4 +11,5 @@ return __p
};
return this["JST"];
});

@ -0,0 +1,11 @@
define(function(){
return function(obj) {
var __t, __p = '', __e = _.escape;
__p += '<head><title>' +
((__t = ( obj.title )) == null ? '' : __t) +
'</title></head>';
return __p
}
});

@ -5,4 +5,5 @@ define(function(){
this["JST"]["test/fixtures/template.html"] = function(obj) {var __t, __p = '', __e = _.escape;__p += '<head><title>' +((__t = ( obj.title )) == null ? '' : __t) +'</title></head>';return __p};
return this["JST"];
});

@ -6,7 +6,7 @@ exports['jst'] = {
var expect, result;
test.expect(9);
test.expect(10);
expect = grunt.file.read("test/expected/jst.js");
result = grunt.file.read("tmp/jst.js");
@ -32,6 +32,10 @@ exports['jst'] = {
result = grunt.file.read("tmp/amd_wrapper.js");
test.equal(expect, result, "should wrap the template with define for AMD pattern");
expect = grunt.file.read("test/expected/amd_wrapper_no_ns.js");
result = grunt.file.read("tmp/amd_wrapper_no_ns.js");
test.equal(expect, result, "should wrap the template with define for AMD pattern and return the function itself with no namespace");
expect = grunt.file.read("test/expected/pretty_amd.js");
result = grunt.file.read("tmp/pretty_amd.js");
test.equal(expect, result, "should make the AMD wrapper output pretty");

Loading…
Cancel
Save