Skip to content

Commit

Permalink
Merge pull request #145 from linkedin/vybs-dustjs
Browse files Browse the repository at this point in the history
 rename grammar tests to core tests, since it testing dust.js core functionality, also has GH-133, fix the missing helper case
  • Loading branch information
vybs committed Sep 12, 2012
2 parents 5c4f5f3 + 3ab0957 commit c22b255
Show file tree
Hide file tree
Showing 6 changed files with 844 additions and 14 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@
code .string, code .regexp { color: #669933 }
code .class, code .special { }
code .number { color: #eddd3d }
code .comment { color: grey }</style><script src="vendor/ecma.js"></script><script src="vendor/jquery.min.js"></script><script src="vendor/jsdump.js"></script><script src="vendor/beautify.js"></script><script src="lib/dust.js"></script><script src="lib/parser.js"></script><script src="lib/compiler.js"></script><script src="test/jasmine-test/spec/grammarTests.js"></script><script src="test/uutest.js"></script><script src="test/core.js"></script><script type="text/javascript">(function(){dust.register("select",body_0);function body_0(chk,ctx){return chk.write("<select style=\"clear: both;\">").section(ctx.get("examples"),ctx,{"block":body_1},null).write("</select>");}function body_1(chk,ctx){return chk.write("<option ").reference(ctx.get("selected"),ctx,"h").write(" value=\"").helper("idx",ctx,{"block":body_2},null).write("\">").reference(ctx.get("name"),ctx,"h").write("</option>");}function body_2(chk,ctx){return chk.reference(ctx.getPath(true,[]),ctx,"h");}return body_0;})();</script><script type="text/javascript">jsDump.parsers['function'] = function(fn) {
code .comment { color: grey }</style><script src="vendor/ecma.js"></script><script src="vendor/jquery.min.js"></script><script src="vendor/jsdump.js"></script><script src="vendor/beautify.js"></script><script src="lib/dust.js"></script><script src="lib/parser.js"></script><script src="lib/compiler.js"></script><script src="test/jasmine-test/spec/coreTests.js"></script><script src="test/uutest.js"></script><script src="test/core.js"></script><script type="text/javascript">(function(){dust.register("select",body_0);function body_0(chk,ctx){return chk.write("<select style=\"clear: both;\">").section(ctx.get("examples"),ctx,{"block":body_1},null).write("</select>");}function body_1(chk,ctx){return chk.write("<option ").reference(ctx.get("selected"),ctx,"h").write(" value=\"").helper("idx",ctx,{"block":body_2},null).write("\">").reference(ctx.get("name"),ctx,"h").write("</option>");}function body_2(chk,ctx){return chk.reference(ctx.getPath(true,[]),ctx,"h");}return body_0;})();</script><script type="text/javascript">jsDump.parsers['function'] = function(fn) {
return fn.toString();
}

Expand Down
7 changes: 6 additions & 1 deletion lib/dust.js
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,12 @@ Chunk.prototype.partial = function(elem, context, params) {
};

Chunk.prototype.helper = function(name, context, bodies, params) {
return dust.helpers[name](this, context, bodies, params);
if( dust.helpers[name]){
return dust.helpers[name](this, context, bodies, params);
}
else {
chunk.setError(new Error("Helper Function Not Found: " + name));
}
};

Chunk.prototype.capture = function(body, context, callback) {
Expand Down
2 changes: 1 addition & 1 deletion test/jasmine-test/server/specRunner.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var jasmine = require('jasmine-node'),

/* this should be declared global in order to access them in the spec*/
dust = require('../../../lib/dust'),
grammarTests = require('../spec/grammarTests');
coreTests = require('../spec/coreTests');

for(key in jasmine)
global[key] = jasmine[key];
Expand Down
Loading

0 comments on commit c22b255

Please sign in to comment.