@@ -19,8 +19,11 @@ module.exports = {
update: function (value) {
var prop = this.prop,
isImportant
+ /* jshint eqeqeq: true */
+ // cast possible numbers/booleans into strings
+ if (value != null) value += ''
if (prop) {
- if (value){
+ if (value) {
isImportant = value.slice(-10) === '!important'
? 'important'
: ''
@@ -715,6 +715,14 @@ describe('Directives', function () {
assert.strictEqual(d.el.style.color, 'rgb(255, 255, 255)')
})
+ it('should work with numbers', function () {
+ var d = mockDirective('style')
+ d.arg = 'line-height'
+ d.bind()
+ d.update(0)
+ assert.strictEqual(d.el.style.lineHeight, '0')
+ })
+
describe('cloak', function () {