Move external AST tests into qunit spec

This commit is contained in:
kpdecker
2013-05-31 13:11:22 -04:00
parent 2024209519
commit ef062adcc2
2 changed files with 4 additions and 11 deletions
-11
View File
@@ -417,21 +417,10 @@ describe "Parser" do
end
context "externally compiled AST" do
it "can pass through an already-compiled AST" do
ast_for(@context.eval('new Handlebars.AST.ProgramNode([ new Handlebars.AST.ContentNode("Hello")]);')).should == root do
content "Hello"
end
end
it "can pass through an already-compiled AST via compile/precompile" do
@context = Handlebars::Spec::CONTEXT
code = 'Handlebars.compile(new Handlebars.AST.ProgramNode([ new Handlebars.AST.ContentNode("Hello")]))();'
@context.eval(code).should == "Hello"
code = @context.eval 'Handlebars.precompile(new Handlebars.AST.ProgramNode([ new Handlebars.AST.ContentNode("Hello")]))'
@context.eval("(#{code})(this)").should == "Hello"
end
end
end
+4
View File
@@ -1538,6 +1538,10 @@ test("Passing falsy values to Handlebars.compile throws an error", function() {
}, "You must pass a string or Handlebars AST to Handlebars.precompile. You passed null");
});
test("can pass through an already-compiled AST via compile/precompile", function() {
equal(Handlebars.compile(new Handlebars.AST.ProgramNode([ new Handlebars.AST.ContentNode("Hello")]))(), 'Hello')
});
test('GH-408: Multiple loops fail', function() {
var context = [
{ name: "John Doe", location: { city: "Chicago" } },