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

Commit 8b9cb92

Browse files
committed
fixup! fix($compile): fix ng-prop-* with undefined values
1 parent 6965611 commit 8b9cb92

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

test/ng/ngPropSpec.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,22 @@ describe('ngProp*', function() {
7575
expect(element.prop('text')).toBe(null);
7676
}));
7777

78+
it('should directly map special properties (class)', inject(function($rootScope, $compile) {
79+
var element = $compile('<span ng-prop-class="myText" />')($rootScope);
80+
$rootScope.myText = 'abc';
81+
$rootScope.$digest();
82+
expect(element[0].class).toBe('abc');
83+
expect(element).not.toHaveClass('abc');
84+
}));
85+
86+
it('should not use jQuery .prop() to avoid jQuery propFix/hooks', inject(function($rootScope, $compile) {
87+
var element = $compile('<span ng-prop-class="myText" />')($rootScope);
88+
spyOn(jqLite.prototype, 'prop');
89+
$rootScope.myText = 'abc';
90+
$rootScope.$digest();
91+
expect(jqLite.prototype.prop).not.toHaveBeenCalled();
92+
}));
93+
7894
it('should support mixed case using underscore-separated names', inject(function($rootScope, $compile) {
7995
var element = $compile('<span ng-prop-a_bcd_e="value" />')($rootScope);
8096
$rootScope.value = 123;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy