Browse files

Added tests for falsey attr values. Closes #120

nevermind :) this works as I would expect, people dont need to || ""
  • Loading branch information...
1 parent 372de2a commit 5b249e849d6ace2978ab3f1aebb99743f670a9e1 @tj tj committed Dec 9, 2010
Showing with 4 additions and 0 deletions.
  1. +4 −0 test/jade.test.js
View
4 test/jade.test.js
@@ -491,6 +491,10 @@ module.exports = {
},
'test code attrs': function(assert){
+ assert.equal('<p></p>', render('p(id: name)', { locals: { name: undefined }}));
+ assert.equal('<p></p>', render('p(id: name)', { locals: { name: null }}));
+ assert.equal('<p></p>', render('p(id: name)', { locals: { name: false }}));
+ assert.equal('<p></p>', render('p(id: name)', { locals: { name: '' }}));
assert.equal('<p id="tj"></p>', render('p(id: name)', { locals: { name: 'tj' }}));
assert.equal('<p id="default"></p>', render('p(id: name || "default")', { locals: { name: null }}));
assert.equal('<p id="something"></p>', render("p(id: 'something')", { locals: { name: null }}));

0 comments on commit 5b249e8

Please sign in to comment.