aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMisko Hevery2012-03-15 14:19:20 -0700
committerMisko Hevery2012-03-19 11:35:10 -0700
commit6ecac8e71a84792a434d21db2c245b3648c55f18 (patch)
treeeb10745ed4de06762e1dccad8c1c8d141b72277e /test
parent823adb231995e917bc060bfa49453e2a96bac2b6 (diff)
downloadangular.js-6ecac8e71a84792a434d21db2c245b3648c55f18.tar.bz2
fix(select): multiselect failes to update view on selection insert
In multiselect when the underlying selection array push/pops an element the view did not re-render since the array reference stayed the same.
Diffstat (limited to 'test')
-rw-r--r--test/directive/selectSpec.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/test/directive/selectSpec.js b/test/directive/selectSpec.js
index e374fbe1..3f8fb56e 100644
--- a/test/directive/selectSpec.js
+++ b/test/directive/selectSpec.js
@@ -102,7 +102,15 @@ describe('select', function() {
scope.selection = ['A'];
});
- expect(element[0].childNodes[0].selected).toEqual(true);
+ expect(element.find('option')[0].selected).toEqual(true);
+ expect(element.find('option')[1].selected).toEqual(false);
+
+ scope.$apply(function() {
+ scope.selection.push('B');
+ });
+
+ expect(element.find('option')[0].selected).toEqual(true);
+ expect(element.find('option')[1].selected).toEqual(true);
});