Closed yiminghe closed 10 years ago
http://jsfiddle.net/yiminghe/ka2ua/
var tpl = '{{#if(x===1)}} 1 {{elseif (x===2)}} 2 {{elseif (x===3)}} 3 {{else}} ! {{/if}}'; var render = new XTemplate(tpl).render({ x: 1 }); expect(render).toBe(' 1 '); render = new XTemplate(tpl).render({ x: 2 }); expect(render).toBe(' 2 '); render = new XTemplate(tpl).render({ x: 3 }); expect(render).toBe(' 3 '); render = new XTemplate(tpl).render({ x: 4 }); expect(render).toBe(' ! ');
support elseif
http://jsfiddle.net/yiminghe/ka2ua/