mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-23 03:30:02 +08:00
fix(option): support option elements in datalist
previously we expected to find option elements only within select element and if that was not the case we throw an error. This made it impossible to include datalist element with nested option elements in the template. Closes #1165
This commit is contained in:
@@ -1108,7 +1108,7 @@ describe('select', function() {
|
||||
});
|
||||
|
||||
|
||||
describe('OPTION value', function() {
|
||||
describe('option', function() {
|
||||
|
||||
it('should populate value attribute on OPTION', function() {
|
||||
compile('<select ng-model="x"><option selected>abc</option></select>');
|
||||
@@ -1125,5 +1125,18 @@ describe('select', function() {
|
||||
compile('<select ng-model="x"><option>hello</select>');
|
||||
expect(element).toEqualSelect(['hello']);
|
||||
});
|
||||
|
||||
it('should not blow up when option directive is found inside of a datalist',
|
||||
inject(function($compile, $rootScope) {
|
||||
var element = $compile('<div>' +
|
||||
'<datalist><option>some val</option></datalist>' +
|
||||
'<span>{{foo}}</span>' +
|
||||
'</div>')($rootScope);
|
||||
|
||||
$rootScope.foo = 'success';
|
||||
$rootScope.$digest();
|
||||
expect(element.find('span').text()).toBe('success');
|
||||
dealoc(element);
|
||||
}));
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user