Przeglądaj źródła

moved new tests into new examples/* files

tags/0.4.0
Ben Cherry 15 lat temu
rodzic
commit
373e263973
10 zmienionych plików z 15 dodań i 45 usunięć
  1. +1
    -0
      examples/double_render.html
  2. +5
    -0
      examples/double_render.js
  3. +1
    -0
      examples/double_render.txt
  4. +1
    -0
      examples/empty_sections.html
  5. +1
    -0
      examples/empty_sections.js
  6. +1
    -0
      examples/empty_sections.txt
  7. +1
    -0
      examples/i18n.html
  8. +3
    -0
      examples/i18n.js
  9. +1
    -0
      examples/i18n.txt
  10. +0
    -45
      test/mustache_spec.rb

+ 1
- 0
examples/double_render.html Wyświetl plik

@@ -0,0 +1 @@
{{#foo}}{{bar}}{{/foo}}

+ 5
- 0
examples/double_render.js Wyświetl plik

@@ -0,0 +1,5 @@
var double_render = {
foo: true,
bar: "{{win}}",
win: "FAIL"
};

+ 1
- 0
examples/double_render.txt Wyświetl plik

@@ -0,0 +1 @@
{{win}}

+ 1
- 0
examples/empty_sections.html Wyświetl plik

@@ -0,0 +1 @@
{{#foo}}{{/foo}}foo{{#bar}}{{/bar}}

+ 1
- 0
examples/empty_sections.js Wyświetl plik

@@ -0,0 +1 @@
var empty_sections = {};

+ 1
- 0
examples/empty_sections.txt Wyświetl plik

@@ -0,0 +1 @@
foo

+ 1
- 0
examples/i18n.html Wyświetl plik

@@ -0,0 +1 @@
{{_i}}foo {{bar}}{{/i}}

+ 3
- 0
examples/i18n.js Wyświetl plik

@@ -0,0 +1,3 @@
var i18n = {
bar: "BAR"
};

+ 1
- 0
examples/i18n.txt Wyświetl plik

@@ -0,0 +1 @@
foo BAR

+ 0
- 45
test/mustache_spec.rb Wyświetl plik

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


Ładowanie…
Anuluj
Zapisz