test(ngStyle): add test for object literal
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user