diff --git a/examples/double_render.html b/examples/double_render.html new file mode 100644 index 0000000..4500fd7 --- /dev/null +++ b/examples/double_render.html @@ -0,0 +1 @@ +{{#foo}}{{bar}}{{/foo}} diff --git a/examples/double_render.js b/examples/double_render.js new file mode 100644 index 0000000..24125dc --- /dev/null +++ b/examples/double_render.js @@ -0,0 +1,5 @@ +var double_render = { + foo: true, + bar: "{{win}}", + win: "FAIL" +}; \ No newline at end of file diff --git a/examples/double_render.txt b/examples/double_render.txt new file mode 100644 index 0000000..b6e652d --- /dev/null +++ b/examples/double_render.txt @@ -0,0 +1 @@ +{{win}} diff --git a/examples/empty_sections.html b/examples/empty_sections.html new file mode 100644 index 0000000..b6065db --- /dev/null +++ b/examples/empty_sections.html @@ -0,0 +1 @@ +{{#foo}}{{/foo}}foo{{#bar}}{{/bar}} diff --git a/examples/empty_sections.js b/examples/empty_sections.js new file mode 100644 index 0000000..6e50514 --- /dev/null +++ b/examples/empty_sections.js @@ -0,0 +1 @@ +var empty_sections = {}; diff --git a/examples/empty_sections.txt b/examples/empty_sections.txt new file mode 100644 index 0000000..257cc56 --- /dev/null +++ b/examples/empty_sections.txt @@ -0,0 +1 @@ +foo diff --git a/examples/i18n.html b/examples/i18n.html new file mode 100644 index 0000000..d39bc61 --- /dev/null +++ b/examples/i18n.html @@ -0,0 +1 @@ +{{_i}}foo {{bar}}{{/i}} diff --git a/examples/i18n.js b/examples/i18n.js new file mode 100644 index 0000000..f85a457 --- /dev/null +++ b/examples/i18n.js @@ -0,0 +1,3 @@ +var i18n = { + bar: "BAR" +}; \ No newline at end of file diff --git a/examples/i18n.txt b/examples/i18n.txt new file mode 100644 index 0000000..46c7bbf --- /dev/null +++ b/examples/i18n.txt @@ -0,0 +1 @@ +foo BAR diff --git a/test/mustache_spec.rb b/test/mustache_spec.rb index 32c75e3..7e93fc9 100644 --- a/test/mustache_spec.rb +++ b/test/mustache_spec.rb @@ -64,51 +64,6 @@ describe "mustache" do run_js(@run_js, js).should == "\n" end - it "should not double-render" do - js = <<-JS - #{@boilerplate} - var template = "{{#foo}}{{bar}}{{/foo}}"; - var ctx = { - foo: true, - bar: "{{win}}", - win: "FAIL" - }; - - print(Mustache.to_html(template, ctx)) - JS - - run_js(@run_js, js).strip.should == "{{win}}" - end - - it "should work with i18n" do - js = <<-JS - #{@boilerplate} - - var template = "{{_i}}foo {{bar}}{{/i}}"; - var ctx = { - bar: "BAR" - }; - - print(Mustache.to_html(template, ctx)); - JS - - run_js(@run_js, js).strip.should == "foo BAR" - end - - it "should work with empty sections" do - js = <<-JS - try{ - #{@boilerplate} - - print(Mustache.to_html("{{#foo}}{{/foo}}foo{{#bar}}{{/bar}}", {})); - } catch(e) { - print(e); - } - JS - - run_js(@run_js, js).strip.should == "foo" - end - non_partials.each do |testname| describe testname do it "should generate the correct html" do