Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
test(ngStyle): add test for object literal
  • Loading branch information
jbedard committed Jul 27, 2017
commit f736f943b4253efa0d938dd5fabf0245d3b82197
12 changes: 12 additions & 0 deletions test/ng/directive/ngStyleSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down