Skip to content

Commit 4baf25b

Browse files
test(ng-options): add tests for option element with no value attribute
See angular#6519
1 parent eb19368 commit 4baf25b

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test/ng/directive/ngOptionsSpec.js

+14
Original file line numberDiff line numberDiff line change
@@ -2029,6 +2029,20 @@ describe('ngOptions', function() {
20292029
expect(option.text()).toBe('is blank');
20302030
});
20312031

2032+
it('should support option without a value attribute', function() {
2033+
createSingleSelect('<option>--select--</option>');
2034+
scope.$apply(function() {
2035+
scope.values = [{name: 'A'}, {name: 'B'}, {name: 'C'}];
2036+
});
2037+
2038+
var options = element.find('option');
2039+
2040+
expect(options.eq(0)).toEqualUnknownOption();
2041+
expect(options.eq(1)).toEqualOption(scope.values[0], 'A');
2042+
expect(options.eq(2)).toEqualOption(scope.values[1], 'B');
2043+
expect(options.eq(3)).toEqualOption(scope.values[2], 'C');
2044+
});
2045+
20322046

20332047
it('should be rendered with the attributes preserved', function() {
20342048
var option;

0 commit comments

Comments
 (0)