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

Commit b5b798b

Browse files
committed
test(ngStyle): add test for object literal
1 parent 79c5144 commit b5b798b

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test/ng/directive/ngStyleSpec.js

+12
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,18 @@ describe('ngStyle', function() {
2323
}));
2424

2525

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

0 commit comments

Comments
 (0)