Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adding test for expression into the tag

  • Loading branch information...
commit dff87ab0ae76f5549b2bcf81ea02a7859d722875 1 parent e6ab189
@krasimir authored
View
2  client-side/build/absurd.js
@@ -1,4 +1,4 @@
-/* version: 0.3.144, born: 8-2-2014 15:35 */
+/* version: 0.3.144, born: 8-2-2014 17:24 */
var Absurd = (function(w) {
var lib = {
api: {},
View
2  client-side/build/absurd.organic.js
@@ -1,4 +1,4 @@
-/* version: 0.3.144, born: 8-2-2014 15:35 */
+/* version: 0.3.144, born: 8-2-2014 17:24 */
var Organic = (function(w){
var o = {
helpers: {},
View
29 client-side/tests/tests.from.node.js
@@ -2060,6 +2060,35 @@ describe("Metamorphosis (to html preprocessor)", function() {
});
});
+ it("should use expressioninside the tag", function(done) {
+ var html = '\
+ <ul id="todo-list">\
+ <% for(var i=0; todo = this.todos[i]; i++) { %>\
+ <li class="<% todo.completed ? \'completed\' : \'\' %>">\
+ <div class="view">\
+ <input class="toggle" type="checkbox" <% todo.completed ? \'checked\' : \'\'%>>\
+ <label><% todo.title %></label>\
+ <button class="destroy"></button>\
+ </div>\
+ <input class="edit" value="">\
+ </li>\
+ <% } %>\
+ </ul>\
+ ';
+ api.morph("html").add(html).compile(function(err, html) {
+ expect(err).toBe(null);
+ expect(html).toBeDefined();
+ expect(html).toBe('<ul id="todo-list"><li class=""><div class="view"><input class="toggle" type="checkbox" ><label>A</label><button class="destroy"></button></div><input class="edit" value=""></li><li class="completed"><div class="view"><input class="toggle" type="checkbox" checked><label>B</label><button class="destroy"></button></div><input class="edit" value=""></li></ul>');
+ done();
+ }, {
+ minify: true,
+ todos: [
+ { title: 'A', completed: false },
+ { title: 'B', completed: true }
+ ]
+ });
+ });
+
});
describe("Metamorphosis (to html preprocessor)", function() {
View
29 tests/metamorphosis/html/morph.html.data.spec.js
@@ -148,4 +148,33 @@ describe("Metamorphosis (to html preprocessor)", function() {
});
});
+ it("should use expressioninside the tag", function(done) {
+ var html = '\
+ <ul id="todo-list">\
+ <% for(var i=0; todo = this.todos[i]; i++) { %>\
+ <li class="<% todo.completed ? \'completed\' : \'\' %>">\
+ <div class="view">\
+ <input class="toggle" type="checkbox" <% todo.completed ? \'checked\' : \'\'%>>\
+ <label><% todo.title %></label>\
+ <button class="destroy"></button>\
+ </div>\
+ <input class="edit" value="">\
+ </li>\
+ <% } %>\
+ </ul>\
+ ';
+ api.morph("html").add(html).compile(function(err, html) {
+ expect(err).toBe(null);
+ expect(html).toBeDefined();
+ expect(html).toBe('<ul id="todo-list"><li class=""><div class="view"><input class="toggle" type="checkbox" ><label>A</label><button class="destroy"></button></div><input class="edit" value=""></li><li class="completed"><div class="view"><input class="toggle" type="checkbox" checked><label>B</label><button class="destroy"></button></div><input class="edit" value=""></li></ul>');
+ done();
+ }, {
+ minify: true,
+ todos: [
+ { title: 'A', completed: false },
+ { title: 'B', completed: true }
+ ]
+ });
+ });
+
});
Please sign in to comment.
Something went wrong with that request. Please try again.