From ef062adcc24ea2c1c617cbe54de6d8982d739a40 Mon Sep 17 00:00:00 2001 From: kpdecker Date: Fri, 31 May 2013 13:11:22 -0400 Subject: [PATCH] Move external AST tests into qunit spec --- spec/parser_spec.rb | 11 ----------- spec/qunit_spec.js | 4 ++++ 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/spec/parser_spec.rb b/spec/parser_spec.rb index 3ee01177..b25e8893 100644 --- a/spec/parser_spec.rb +++ b/spec/parser_spec.rb @@ -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 diff --git a/spec/qunit_spec.js b/spec/qunit_spec.js index 14dbee7e..ec58570f 100644 --- a/spec/qunit_spec.js +++ b/spec/qunit_spec.js @@ -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" } },