浏览代码

make the tests also test a generic send function (reveals failures)

tags/0.2.3
Chris Anderson 16 年前
父节点
当前提交
f864a27cb9
共有 1 个文件被更改,包括 42 次插入0 次删除
  1. +42
    -0
      test/mustache_spec.rb

+ 42
- 0
test/mustache_spec.rb 查看文件

@@ -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




正在加载...
取消
保存