Sfoglia il codice sorgente

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

tags/0.2.3
Chris Anderson 16 anni fa
parent
commit
f864a27cb9
1 ha cambiato i file con 42 aggiunte e 0 eliminazioni
  1. +42
    -0
      test/mustache_spec.rb

+ 42
- 0
test/mustache_spec.rb Vedi File

@@ -60,6 +60,28 @@ describe "mustache" do

run_js(runner).should == expect
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

@@ -85,6 +107,26 @@ describe "mustache" do
run_js(runner).should == expect
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



Loading…
Annulla
Salva