test(ngStyle): add test for object literal

This commit is contained in:
Jason Bedard
2017-05-04 22:39:21 -07:00
parent 15bbd3e18c
commit ac57a25cd9
+12
View File
@@ -38,6 +38,18 @@ describe('ngStyle', function() {
}));
it('should support binding for object literals', inject(function($rootScope, $compile) {
element = $compile('<div ng-style="{height: heightStr}"></div>')($rootScope);
$rootScope.$digest();
expect(parseInt(element.css('height') + 0, 10)).toEqual(0); // height could be '' or '0px'
$rootScope.$apply('heightStr = "40px"');
expect(element.css('height')).toBe('40px');
$rootScope.$apply('heightStr = "100px"');
expect(element.css('height')).toBe('100px');
}));
it('should support lazy one-time binding for object literals', inject(function($rootScope, $compile) {
element = $compile('<div ng-style="::{height: heightStr}"></div>')($rootScope);
$rootScope.$digest();