diff options
Diffstat (limited to 'test/ng/directive')
| -rw-r--r-- | test/ng/directive/selectSpec.js | 21 |
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( |
