Add tests for return type of color and theme properties

This commit is contained in:
cjc 2012-01-19 18:51:41 +10:00
parent 4b2ae6c5ec
commit 3aed695b49

10
test.js
View File

@ -46,6 +46,11 @@ aE(s, 'red', 31);
aE(s, 'yellow', 33); aE(s, 'yellow', 33);
assert.equal(s, 'string'); assert.equal(s, 'string');
colors.setTheme({error:'red'});
assert.equal(typeof("astring".red),'string');
assert.equal(typeof("astring".error),'string');
colors.mode = 'browser'; colors.mode = 'browser';
assert.equal(s.bold, '<b>' + s + '</b>'); assert.equal(s.bold, '<b>' + s + '</b>');
assert.equal(s.italic, '<i>' + s + '</i>'); assert.equal(s.italic, '<i>' + s + '</i>');
@ -57,9 +62,14 @@ stylesColors.forEach(function (color) {
assert.equal(colors[color](s), h(s, color)); assert.equal(colors[color](s), h(s, color));
}); });
assert.equal(typeof("astring".red),'string');
assert.equal(typeof("astring".error),'string');
colors.mode = 'none'; colors.mode = 'none';
stylesAll.forEach(function (style) { stylesAll.forEach(function (style) {
assert.equal(s[style], s); assert.equal(s[style], s);
assert.equal(colors[style](s), s); assert.equal(colors[style](s), s);
}); });
assert.equal(typeof("astring".red),'string');
assert.equal(typeof("astring".error),'string');