From 6c67719dfa6ff3f2a15a8e1e7660cf2e6e9155b0 Mon Sep 17 00:00:00 2001
From: petrovalex
Date: Tue, 14 Aug 2012 22:45:01 +0300
Subject: fix(ngClassEven/Odd): filtering/ordering and repeater
Closes #1076
---
test/ng/directive/ngClassSpec.js | 44 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 44 insertions(+)
(limited to 'test')
diff --git a/test/ng/directive/ngClassSpec.js b/test/ng/directive/ngClassSpec.js
index fc46bf7c..4a53030b 100644
--- a/test/ng/directive/ngClassSpec.js
+++ b/test/ng/directive/ngClassSpec.js
@@ -234,4 +234,48 @@ describe('ngClass', function() {
expect(element.hasClass('two')).toBeFalsy();
expect(element.hasClass('too')).toBeFalsy();
}));
+
+
+ it('should update ngClassOdd/Even when model is changed by filtering', inject(function($rootScope, $compile) {
+ element = $compile('
' +
+ '' +
+ '')($rootScope);
+ $rootScope.items = ['a','b','a'];
+ $rootScope.$digest();
+
+ $rootScope.items = ['a','a'];
+ $rootScope.$digest();
+
+ var e1 = jqLite(element[0].childNodes[1]);
+ var e2 = jqLite(element[0].childNodes[2]);
+
+ expect(e1.hasClass('odd')).toBeTruthy();
+ expect(e1.hasClass('even')).toBeFalsy();
+
+ expect(e2.hasClass('even')).toBeTruthy();
+ expect(e2.hasClass('odd')).toBeFalsy();
+ }));
+
+
+ it('should update ngClassOdd/Even when model is changed by sorting', inject(function($rootScope, $compile) {
+ element = $compile('' +
+ '- i
' +
+ '')($rootScope);
+ $rootScope.items = ['a','b'];
+ $rootScope.$digest();
+
+ $rootScope.items = ['b','a'];
+ $rootScope.$digest();
+
+ var e1 = jqLite(element[0].childNodes[1]);
+ var e2 = jqLite(element[0].childNodes[2]);
+
+ expect(e1.hasClass('odd')).toBeTruthy();
+ expect(e1.hasClass('even')).toBeFalsy();
+
+ expect(e2.hasClass('even')).toBeTruthy();
+ expect(e2.hasClass('odd')).toBeFalsy();
+ }));
});
--
cgit v1.2.3