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

Commit 3b91bb1

Browse files
committed
fix(ngClass): improve code of mutating object test case
1 parent e54492c commit 3b91bb1

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

test/ng/directive/ngClassSpec.js

+12-8
Original file line numberDiff line numberDiff line change
@@ -410,16 +410,20 @@ describe('ngClass', function() {
410410
expect(e2.hasClass('odd')).toBeFalsy();
411411
}));
412412

413-
it('should support changing multiple classes via variable array mixed with conditionally via a map', inject(function($rootScope, $compile) {
414-
$rootScope.classVar = ['', {orange: true}];
415-
element = $compile('<div class="existing" ng-class="classVar"></div>')($rootScope);
416-
$rootScope.$digest();
413+
it('should support mixed array/object variable with a mutating object',
414+
inject(function($rootScope, $compile) {
415+
element = $compile('<div ng-class="classVar"></div>')($rootScope);
417416

418-
$rootScope.classVar[1].orange = false;
419-
$rootScope.$digest();
417+
$rootScope.classVar = [{orange: true}];
418+
$rootScope.$digest();
419+
expect(element).toHaveClass('orange');
420420

421-
expect(element.hasClass('orange')).toBeFalsy();
422-
}));
421+
$rootScope.classVar[0].orange = false;
422+
$rootScope.$digest();
423+
424+
expect(element).not.toHaveClass('orange');
425+
})
426+
);
423427

424428
});
425429

0 commit comments

Comments
 (0)