mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-06-16 18:29:57 +08:00
test(ng-include): add ng-include=src test
This commit is contained in:
@@ -30,10 +30,23 @@ describe('ng-include', function() {
|
||||
}));
|
||||
|
||||
|
||||
it('should support ng-include="src" syntax', inject(putIntoCache('myUrl', '{{name}}'),
|
||||
function($rootScope, $compile) {
|
||||
element = jqLite('<div ng-include="url"></div>');
|
||||
jqLite(document.body).append(element);
|
||||
element = $compile(element)($rootScope);
|
||||
$rootScope.name = 'Alibaba';
|
||||
$rootScope.url = 'myUrl';
|
||||
$rootScope.$digest();
|
||||
expect(element.text()).toEqual('Alibaba');
|
||||
jqLite(document.body).html('');
|
||||
}));
|
||||
|
||||
|
||||
it('should remove previously included text if a falsy value is bound to src', inject(
|
||||
putIntoCache('myUrl', '{{name}}'),
|
||||
function($rootScope, $compile, $browser) {
|
||||
element = jqLite('<div ng-include="url" scope="childScope"></div>');
|
||||
function($rootScope, $compile) {
|
||||
element = jqLite('<ng:include src="url" scope="childScope"></ng:include>');
|
||||
element = $compile(element)($rootScope);
|
||||
$rootScope.childScope = $rootScope.$new();
|
||||
$rootScope.childScope.name = 'igor';
|
||||
|
||||
Reference in New Issue
Block a user