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

Commit dd7b0f5

Browse files
committed
fix(ng-cloak): work with class
1 parent b375010 commit dd7b0f5

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

src/directives.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -937,7 +937,7 @@ var ngStyleDirective = ngDirective(function(scope, element, attr) {
937937
*/
938938
var ngCloakDirective = ngDirective({
939939
compile: function(element, attr) {
940-
attr.$set(attr.$attr.ngCloak, undefined);
940+
attr.$set('ngCloak', undefined);
941941
element.removeClass('ng-cloak');
942942
}
943943
});

test/directivesSpec.js

+16-1
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ describe("directive", function() {
543543
}));
544544

545545

546-
it('should remove ng-cloak class from a compiled element', inject(function($rootScope, $compile) {
546+
it('should remove ng-cloak class from a compiled element with attribute', inject(function($rootScope, $compile) {
547547
element = jqLite('<div ng:cloak class="foo ng-cloak bar"></div>');
548548

549549
expect(element.hasClass('foo')).toBe(true);
@@ -556,6 +556,21 @@ describe("directive", function() {
556556
expect(element.hasClass('ng-cloak')).toBe(false);
557557
expect(element.hasClass('bar')).toBe(true);
558558
}));
559+
560+
561+
it('should remove ng-cloak class from a compiled element', inject(function($rootScope, $compile) {
562+
element = jqLite('<div class="foo ng-cloak bar"></div>');
563+
564+
expect(element.hasClass('foo')).toBe(true);
565+
expect(element.hasClass('ng-cloak')).toBe(true);
566+
expect(element.hasClass('bar')).toBe(true);
567+
568+
$compile(element);
569+
570+
expect(element.hasClass('foo')).toBe(true);
571+
expect(element.hasClass('ng-cloak')).toBe(false);
572+
expect(element.hasClass('bar')).toBe(true);
573+
}));
559574
});
560575

561576

0 commit comments

Comments
 (0)