From ab407de54d04133e2089086d6c574592c8a19ffc Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Thu, 15 Sep 2011 00:50:00 +0200 Subject: [PATCH] fix(jqLiteSpec): jQuery's css() getter works only for valid rules foo.css('bogus', 'value') foo.css('bogus') => null so I had to change all tests to use valid css rules --- test/jqLiteSpec.js | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/test/jqLiteSpec.js b/test/jqLiteSpec.js index ed929cb7616a..6578022c07b7 100644 --- a/test/jqLiteSpec.js +++ b/test/jqLiteSpec.js @@ -288,34 +288,35 @@ describe('jqLite', function(){ it('should set and read css', function(){ var selector = jqLite([a, b]); - expect(selector.css('prop', 'value')).toEqual(selector); - expect(jqLite(a).css('prop')).toEqual('value'); - expect(jqLite(b).css('prop')).toEqual('value'); + expect(selector.css('margin', '1px')).toEqual(selector); + expect(jqLite(a).css('margin')).toEqual('1px'); + expect(jqLite(b).css('margin')).toEqual('1px'); - expect(selector.css({'prop': 'new value'})).toEqual(selector); - expect(jqLite(a).css('prop')).toEqual('new value'); - expect(jqLite(b).css('prop')).toEqual('new value'); + expect(selector.css({'margin': '2px'})).toEqual(selector); + expect(jqLite(a).css('margin')).toEqual('2px'); + expect(jqLite(b).css('margin')).toEqual('2px'); - jqLite(b).css({'prop': 'new value 2'}); - expect(jqLite(selector).css('prop')).toEqual('new value'); - expect(jqLite(b).css('prop')).toEqual('new value 2'); + jqLite(b).css({'margin': '3px'}); + expect(jqLite(selector).css('margin')).toEqual('2px'); + expect(jqLite(a).css('margin')).toEqual('2px'); + expect(jqLite(b).css('margin')).toEqual('3px'); - selector.css('prop', null); - expect(jqLite(a).css('prop')).toBeFalsy(); - expect(jqLite(b).css('prop')).toBeFalsy(); + selector.css('margin', ''); + expect(jqLite(a).css('margin')).toBeFalsy(); + expect(jqLite(b).css('margin')).toBeFalsy(); }); it('should set a bunch of css properties specified via an object', function() { - expect(jqLite(a).css('foo')).toBeFalsy(); - expect(jqLite(a).css('bar')).toBeFalsy(); - expect(jqLite(a).css('baz')).toBeFalsy(); + expect(jqLite(a).css('margin')).toBeFalsy(); + expect(jqLite(a).css('padding')).toBeFalsy(); + expect(jqLite(a).css('border')).toBeFalsy(); - jqLite(a).css({'foo': 'a', 'bar': 'b', 'baz': ''}); + jqLite(a).css({'margin': '1px', 'padding': '2px', 'border': ''}); - expect(jqLite(a).css('foo')).toBe('a'); - expect(jqLite(a).css('bar')).toBe('b'); - expect(jqLite(a).css('baz')).toBeFalsy(); + expect(jqLite(a).css('margin')).toBe('1px'); + expect(jqLite(a).css('padding')).toBe('2px'); + expect(jqLite(a).css('border')).toBeFalsy(); }); });