aboutsummaryrefslogtreecommitdiffstats
path: root/test/ng/directive/selectSpec.js
diff options
context:
space:
mode:
author_pants2012-11-29 11:46:51 -0500
committerIgor Minar2012-12-05 02:20:11 +0100
commit26adeb119bc4fafa6286de484626b8de4170abc9 (patch)
treef37d93da400aab1d23b96b0c6810222968b468ba /test/ng/directive/selectSpec.js
parent15183f3e1fbee031c9595206163962788f98b298 (diff)
downloadangular.js-26adeb119bc4fafa6286de484626b8de4170abc9.tar.bz2
fix(select): support optgroup + select[multiple] combo
Closes #1553
Diffstat (limited to 'test/ng/directive/selectSpec.js')
-rw-r--r--test/ng/directive/selectSpec.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/ng/directive/selectSpec.js b/test/ng/directive/selectSpec.js
index 7d17a185..2b56228d 100644
--- a/test/ng/directive/selectSpec.js
+++ b/test/ng/directive/selectSpec.js
@@ -405,6 +405,27 @@ describe('select', function() {
expect(element).toEqualSelect(['A'], ['B']);
});
+ it('should work with optgroups', function() {
+ compile('<select ng-model="selection" multiple>' +
+ '<optgroup label="group1">' +
+ '<option>A</option>' +
+ '<option>B</option>' +
+ '</optgroup>' +
+ '</select>');
+
+ expect(element).toEqualSelect('A', 'B');
+ expect(scope.selection).toBeUndefined();
+
+ scope.$apply(function() {
+ scope.selection = ['A'];
+ });
+ expect(element).toEqualSelect(['A'], 'B');
+
+ scope.$apply(function() {
+ scope.selection.push('B');
+ });
+ expect(element).toEqualSelect(['A'], ['B']);
+ });
it('should require', function() {
compile(