Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 29e6e9a

Browse files
committed
test(ngStyle): add test for object literal
1 parent 08898f6 commit 29e6e9a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/ng/directive/ngStyleSpec.js

+10
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,16 @@ describe('ngStyle', function() {
2222
expect(element.hasClass('ng-exception')).toBeFalsy();
2323
}));
2424

25+
it('should support binding for object literals', inject(function($rootScope, $compile) {
26+
element = $compile('<div ng-style="{height: heightStr}"></div>')($rootScope);
27+
$rootScope.$digest();
28+
expect(parseInt(element.css('height') + 0, 10)).toEqual(0); // height could be '' or '0px'
29+
$rootScope.$apply('heightStr = "40px"');
30+
expect(element.css('height')).toBe('40px');
31+
32+
$rootScope.$apply('heightStr = "100px"');
33+
expect(element.css('height')).toBe('100px');
34+
}));
2535

2636
it('should support lazy one-time binding for object literals', inject(function($rootScope, $compile) {
2737
element = $compile('<div ng-style="::{height: heightStr}"></div>')($rootScope);

0 commit comments

Comments
 (0)