mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-08 17:10:06 +08:00
test($compile): add tests for <option> or <optgroup> tags as root template nodes
This commit is contained in:
committed by
Caitlin Potter
parent
ba66c4f3cc
commit
81395ac298
@@ -541,6 +541,14 @@ describe('$compile', function() {
|
||||
replace: true,
|
||||
template: '<tfoot><tr><td>TD</td></tr></tfoot>'
|
||||
}));
|
||||
directive('replaceWithOption', valueFn({
|
||||
replace: true,
|
||||
template: '<option>OPTION</option>'
|
||||
}));
|
||||
directive('replaceWithOptgroup', valueFn({
|
||||
replace: true,
|
||||
template: '<optgroup>OPTGROUP</optgroup>'
|
||||
}));
|
||||
}));
|
||||
|
||||
|
||||
@@ -746,6 +754,20 @@ describe('$compile', function() {
|
||||
}).not.toThrow();
|
||||
expect(nodeName_(element)).toMatch(/tfoot/i);
|
||||
}));
|
||||
|
||||
it('should support templates with root <option> tags', inject(function($compile, $rootScope) {
|
||||
expect(function() {
|
||||
element = $compile('<div replace-with-option></div>')($rootScope);
|
||||
}).not.toThrow();
|
||||
expect(nodeName_(element)).toMatch(/option/i);
|
||||
}));
|
||||
|
||||
it('should support templates with root <optgroup> tags', inject(function($compile, $rootScope) {
|
||||
expect(function() {
|
||||
element = $compile('<div replace-with-optgroup></div>')($rootScope);
|
||||
}).not.toThrow();
|
||||
expect(nodeName_(element)).toMatch(/optgroup/i);
|
||||
}));
|
||||
});
|
||||
|
||||
|
||||
@@ -867,6 +889,14 @@ describe('$compile', function() {
|
||||
replace: true,
|
||||
templateUrl: 'tfoot.html'
|
||||
}));
|
||||
directive('replaceWithOption', valueFn({
|
||||
replace: true,
|
||||
templateUrl: 'option.html'
|
||||
}));
|
||||
directive('replaceWithOptgroup', valueFn({
|
||||
replace: true,
|
||||
templateUrl: 'optgroup.html'
|
||||
}));
|
||||
}
|
||||
));
|
||||
|
||||
@@ -1556,6 +1586,24 @@ describe('$compile', function() {
|
||||
$rootScope.$digest();
|
||||
expect(nodeName_(element)).toMatch(/tfoot/i);
|
||||
}));
|
||||
|
||||
it('should support templates with root <option> tags', inject(function($compile, $rootScope, $templateCache) {
|
||||
$templateCache.put('option.html', '<option>OPTION</option>');
|
||||
expect(function() {
|
||||
element = $compile('<div replace-with-option></div>')($rootScope);
|
||||
}).not.toThrow();
|
||||
$rootScope.$digest();
|
||||
expect(nodeName_(element)).toMatch(/option/i);
|
||||
}));
|
||||
|
||||
it('should support templates with root <optgroup> tags', inject(function($compile, $rootScope, $templateCache) {
|
||||
$templateCache.put('optgroup.html', '<optgroup>OPTGROUP</optgroup>');
|
||||
expect(function() {
|
||||
element = $compile('<div replace-with-optgroup></div>')($rootScope);
|
||||
}).not.toThrow();
|
||||
$rootScope.$digest();
|
||||
expect(nodeName_(element)).toMatch(/optgroup/i);
|
||||
}));
|
||||
});
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user