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

Commit ac57a25

Browse files
committed
test(ngStyle): add test for object literal
1 parent 15bbd3e commit ac57a25

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
@@ -38,6 +38,18 @@ describe('ngStyle', function() {
3838
}));
3939

4040

41+
it('should support binding for object literals', inject(function($rootScope, $compile) {
42+
element = $compile('<div ng-style="{height: heightStr}"></div>')($rootScope);
43+
$rootScope.$digest();
44+
expect(parseInt(element.css('height') + 0, 10)).toEqual(0); // height could be '' or '0px'
45+
$rootScope.$apply('heightStr = "40px"');
46+
expect(element.css('height')).toBe('40px');
47+
48+
$rootScope.$apply('heightStr = "100px"');
49+
expect(element.css('height')).toBe('100px');
50+
}));
51+
52+
4153
it('should support lazy one-time binding for object literals', inject(function($rootScope, $compile) {
4254
element = $compile('<div ng-style="::{height: heightStr}"></div>')($rootScope);
4355
$rootScope.$digest();

0 commit comments

Comments
 (0)