aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMisko Hevery2012-03-08 16:11:32 -0800
committerMisko Hevery2012-03-08 16:30:39 -0800
commitdd7b0f56fcd9785f7fccae8c4f088a8f3e7b125e (patch)
treee3566653ce4047ee9f3ae1d8c0a294aa2541cbcf
parentb3750103cc2c696b4ecadd7eebc55a76fd528bce (diff)
downloadangular.js-dd7b0f56fcd9785f7fccae8c4f088a8f3e7b125e.tar.bz2
fix(ng-cloak): work with class
-rw-r--r--src/directives.js2
-rw-r--r--test/directivesSpec.js17
2 files changed, 17 insertions, 2 deletions
diff --git a/src/directives.js b/src/directives.js
index 91241a16..9b231850 100644
--- a/src/directives.js
+++ b/src/directives.js
@@ -937,7 +937,7 @@ var ngStyleDirective = ngDirective(function(scope, element, attr) {
*/
var ngCloakDirective = ngDirective({
compile: function(element, attr) {
- attr.$set(attr.$attr.ngCloak, undefined);
+ attr.$set('ngCloak', undefined);
element.removeClass('ng-cloak');
}
});
diff --git a/test/directivesSpec.js b/test/directivesSpec.js
index c0533745..1ce6090b 100644
--- a/test/directivesSpec.js
+++ b/test/directivesSpec.js
@@ -543,7 +543,7 @@ describe("directive", function() {
}));
- it('should remove ng-cloak class from a compiled element', inject(function($rootScope, $compile) {
+ it('should remove ng-cloak class from a compiled element with attribute', inject(function($rootScope, $compile) {
element = jqLite('<div ng:cloak class="foo ng-cloak bar"></div>');
expect(element.hasClass('foo')).toBe(true);
@@ -556,6 +556,21 @@ describe("directive", function() {
expect(element.hasClass('ng-cloak')).toBe(false);
expect(element.hasClass('bar')).toBe(true);
}));
+
+
+ it('should remove ng-cloak class from a compiled element', inject(function($rootScope, $compile) {
+ element = jqLite('<div class="foo ng-cloak bar"></div>');
+
+ expect(element.hasClass('foo')).toBe(true);
+ expect(element.hasClass('ng-cloak')).toBe(true);
+ expect(element.hasClass('bar')).toBe(true);
+
+ $compile(element);
+
+ expect(element.hasClass('foo')).toBe(true);
+ expect(element.hasClass('ng-cloak')).toBe(false);
+ expect(element.hasClass('bar')).toBe(true);
+ }));
});