Permalink
Browse files

Fixed missing closing tag in layout sample and modified unit test.

  • Loading branch information...
BorisMoore committed Apr 17, 2012
1 parent ac492d1 commit c3788428ac611d6d10690d56098c49f2af9793aa
Showing with 29 additions and 32 deletions.
  1. +27 −30 demos/step-by-step/14_layout-templates.html
  2. +2 −2 test/unit/jsrender-tests-no-jquery.js
@@ -44,36 +44,33 @@ <h3>Using layout templates to render arrays along with headers or footers.</h3>
<!--================ Demo ================-->
<script id="movieTemplate" type="text/x-jsrender">
- <tbody class="header">
- <tr><th colspan="2">{{:length}} movies available:</th></tr>
- <tr><th>Title</th><th>Languages</th></tr>
- </tbody>
- <tbody>
- {{for #data}}
- <tr>
- <td>{{:title}}</td>
- <td>
- {{for languages layout=true}}
- <div>
- {{if #data}}
- <strong>{{:length}}</strong> languages available:
- {{else}}
- Original version only
- {{/if}}
-
- {{for #data}}
- <em>{{:name}}</em>
- {{/for}}
- </div>
- <div>
- {{if #data}}
- Additional languages also in stock
- {{/if}}
- </div>
- {{/for}}
- </td>
- </tr>
- {{/for}}
+ <tr class="header"><th colspan="2">{{:length}} movies available:</th></tr>
+ <tr class="header"><th>Title</th><th>Languages</th></tr>
+ {{for #data}}
+ <tr>
+ <td>{{:title}}</td>
+ <td>
+ {{for languages layout=true}}
+ <div>
+ {{if #data}}
+ <strong>{{:length}}</strong> languages available:
+ {{else}}
+ Original version only
+ {{/if}}
+
+ {{for #data}}
+ <em>{{:name}}</em>
+ {{/for}}
+ </div>
+ <div>
+ {{if #data}}
+ Additional languages also in stock
+ {{/if}}
+ </div>
+ {{/for}}
+ </td>
+ </tr>
+ {{/for}}
</script>
<table id="movieList"></table>
@@ -196,7 +196,7 @@ test("{{for}}", function() {
equal( jsviews.templates( "{{for people towns}}{{:name}}{{/for}}" ).render({ people: people, towns: towns }), "JoBillSeattleParisDelhi", "concatenated targets: {{for people towns}}" );
equal( jsviews.render.simpleFor({people:[]}), "ab", 'Empty array renders empty string' );
- equal( jsviews.render.simpleFor({people:[null,undefined,1]}), "aContentContentContentb", 'null or undefined members of array are also rendered' );
+ equal( jsviews.render.simpleFor({people:["",false,null,undefined,1]}), "aContentContentContentContentContentb", 'Empty string, false, null or undefined members of array are also rendered' );
equal( jsviews.render.simpleFor({people:null}), "ab", 'null is rendered as empty string' );
equal( jsviews.render.simpleFor({}), "ab", 'undefined is rendered as empty string' );
equal( jsviews.render.forPrimitiveDataTypes({people:[0,1,"abc","",,true,false]}), "a01abctruefalseb", 'Primitive types render correctly, even if falsey' );
@@ -276,7 +276,7 @@ test("render", function() {
equal( jsviews.templates( tmplString ).render( person ), "A_Jo_B", 'Compile from string: var html = jsviews.templates( tmplString ).render( data );' );
equal( jsviews.render.myTmpl8( people ), "A_Jo_BA_Bill_B", 'jsviews.render.myTmpl( array );' );
equal( jsviews.render.simple([]), "", 'Empty array renders empty string' );
- equal( jsviews.render.simple([null,undefined,1]), "ContentContentContent", 'null or undefined members of array are also rendered' );
+ equal( jsviews.render.simple(["",false,null,undefined,1]), "ContentContentContentContentContent", 'Empty string, false, null or undefined members of array are also rendered' );
equal( jsviews.render.simple(null), "", 'null renders as empty string' );
equal( jsviews.render.simple(), "", 'Undefined renders as empty string' );

0 comments on commit c378842

Please sign in to comment.