aboutsummaryrefslogtreecommitdiffstats
path: root/test/directivesSpec.js
diff options
context:
space:
mode:
authorIgor Minar2011-07-19 16:07:25 -0700
committerIgor Minar2011-07-19 16:07:25 -0700
commit3ea2416f8083a21bf2f47f3381a66bf97e7f59e2 (patch)
treecd0d1d2990802732614f025c958bbec2eda34c25 /test/directivesSpec.js
parent96361603322787117846e45573220c3cebdedb14 (diff)
downloadangular.js-3ea2416f8083a21bf2f47f3381a66bf97e7f59e2.tar.bz2
Revert "fix(ng:class): preserve classes added post compilation"
This reverts commit 2428907259fa80ec3b1b4bfd85ea20028a9f4fa5. We decided to revert this because it is not bullet proof. The issue is that we can't reliably have both angular and non-angular code in charge of the DOM. We could work around some issues here and there, but we can't do it reliably, so it's better not to support DOM manipulation that happens outside of angular. There is a good chance that once we integrate with MDVs our possition will change, but until then our position is that only angular or angular widgets/directives can change change DOM that was compiled.
Diffstat (limited to 'test/directivesSpec.js')
-rw-r--r--test/directivesSpec.js41
1 files changed, 1 insertions, 40 deletions
diff --git a/test/directivesSpec.js b/test/directivesSpec.js
index 39c52ac6..bb530128 100644
--- a/test/directivesSpec.js
+++ b/test/directivesSpec.js
@@ -179,7 +179,7 @@ describe("directive", function(){
describe('ng:class', function() {
- it('should change current class or remove old classes dynamically', function() {
+ it('should add new and remove old classes dynamically', function() {
var scope = compile('<div class="existing" ng:class="dynClass"></div>');
scope.dynClass = 'A';
scope.$eval();
@@ -206,45 +206,6 @@ describe("directive", function(){
expect(element.hasClass('A')).toBeTruthy();
expect(element.hasClass('B')).toBeTruthy();
});
-
- it('should preserve class added post compilation', function() {
- var scope = compile('<div class="existing" ng:class="dynClass"></div>');
- scope.dynClass = 'A';
- scope.$eval();
- expect(element.hasClass('existing')).toBe(true);
-
- // add extra class, change model and eval
- element.addClass('newClass');
- scope.dynClass = 'B';
- scope.$eval();
-
- expect(element.hasClass('existing')).toBe(true);
- expect(element.hasClass('B')).toBe(true);
- expect(element.hasClass('newClass')).toBe(true);
- });
-
- it('should preserve class added post compilation even without existing classes"', function() {
- var scope = compile('<div ng:class="dynClass"></div>');
- scope.dynClass = 'A';
- scope.$eval();
- expect(element.hasClass('A')).toBe(true);
-
- // add extra class, change model and eval
- element.addClass('newClass');
- scope.dynClass = 'B';
- scope.$eval();
-
- expect(element.hasClass('B')).toBe(true);
- expect(element.hasClass('newClass')).toBe(true);
- });
-
- it('should preserve right classes"', function() {
- var scope = compile('<div class="ui-panel ui-selected" ng:class="dynCls"></div>');
- scope.dynCls = 'panel';
- scope.dynCls = 'foo';
- scope.$eval();
- expect(element.attr('class')).toBe('ui-panel ui-selected ng-directive foo');
- });
});