| @@ -60,6 +60,28 @@ describe "mustache" do | |||||
| run_js(runner).should == expect | run_js(runner).should == expect | ||||
| end | end | ||||
| it "should sendFun the correct html" do | |||||
| view, template, expect = load_test(__DIR__, testname) | |||||
| runner = <<-JS | |||||
| try { | |||||
| #{@mustache} | |||||
| #{view} | |||||
| var chunks = []; | |||||
| var sendFun = function(chunk) { | |||||
| chunks.push(chunk); | |||||
| } | |||||
| var template = #{template}; | |||||
| Mustache.to_html(template, #{testname}, null, sendFun); | |||||
| print(chunks.join("\\n")); | |||||
| } catch(e) { | |||||
| print('ERROR: ' + e.message); | |||||
| } | |||||
| JS | |||||
| run_js(runner).strip.should == expect.strip | |||||
| end | |||||
| end | end | ||||
| end | end | ||||
| @@ -85,6 +107,26 @@ describe "mustache" do | |||||
| run_js(runner).should == expect | run_js(runner).should == expect | ||||
| end | end | ||||
| it "should sendFun the correct html" do | |||||
| view, template, partial, expect = | |||||
| load_test(__DIR__, testname, true) | |||||
| runner = <<-JS | |||||
| try { | |||||
| #{@mustache} | |||||
| #{view}; | |||||
| var template = #{template}; | |||||
| var partials = {"partial": #{partial}}; | |||||
| var result = Mustache.to_html(template, partial_context, partials); | |||||
| print(result); | |||||
| } catch(e) { | |||||
| print('ERROR: ' + e.message); | |||||
| } | |||||
| JS | |||||
| run_js(runner).strip.should == expect.strip | |||||
| end | |||||
| end | end | ||||
| end | end | ||||