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

Commit 704ce65

Browse files
committed
test(ngStyle): add a test for falsy values
1 parent 5d74f0f commit 704ce65

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

test/ng/directive/ngStyleSpec.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,5 +120,16 @@ describe('ngStyle', function() {
120120
expect(element.css(preCompStyle)).not.toBe('88px');
121121
expect(element.css(postCompStyle)).not.toBe('99px');
122122
});
123+
124+
it('should clear style when the value is falsy', function() {
125+
scope.styleObj = {'height': '99px', 'width': '88px'};
126+
scope.$apply();
127+
expect(element.css(preCompStyle)).toBe('88px');
128+
expect(element.css(postCompStyle)).toBe('99px');
129+
scope.styleObj = {'height': undefined, 'width': null};
130+
scope.$apply();
131+
expect(element.css(preCompStyle)).not.toBe('88px');
132+
expect(element.css(postCompStyle)).not.toBe('99px');
133+
});
123134
});
124135
});

0 commit comments

Comments
 (0)