mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-28 07:23:59 +00:00
fix(test): fixed toThrow usage
This commit is contained in:
parent
265f0b5225
commit
4b71bbc988
1 changed files with 10 additions and 5 deletions
|
|
@ -64,14 +64,16 @@ describe('ngInclude', function() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
it('should NOT use untrusted expressions ', inject(putIntoCache('myUrl', '{{name}} text'),
|
it('should NOT use untrusted URL expressions ', inject(putIntoCache('myUrl', '{{name}} text'),
|
||||||
function($rootScope, $compile, $sce) {
|
function($rootScope, $compile, $sce) {
|
||||||
element = jqLite('<ng:include src="url"></ng:include>');
|
element = jqLite('<ng:include src="url"></ng:include>');
|
||||||
jqLite(document.body).append(element);
|
jqLite(document.body).append(element);
|
||||||
element = $compile(element)($rootScope);
|
element = $compile(element)($rootScope);
|
||||||
$rootScope.name = 'chirayu';
|
$rootScope.name = 'chirayu';
|
||||||
$rootScope.url = 'myUrl';
|
$rootScope.url = 'http://example.com/myUrl';
|
||||||
expect($rootScope.$digest).toThrow();
|
expect(function() { $rootScope.$digest(); }).toThrowMinErr(
|
||||||
|
'$sce', 'insecurl',
|
||||||
|
/Blocked loading resource from url not allowed by \$sceDelegate policy. URL: http:\/\/example.com\/myUrl.*/);
|
||||||
jqLite(document.body).html('');
|
jqLite(document.body).html('');
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
@ -82,11 +84,14 @@ describe('ngInclude', function() {
|
||||||
jqLite(document.body).append(element);
|
jqLite(document.body).append(element);
|
||||||
element = $compile(element)($rootScope);
|
element = $compile(element)($rootScope);
|
||||||
$rootScope.name = 'chirayu';
|
$rootScope.name = 'chirayu';
|
||||||
$rootScope.url = $sce.trustAsUrl('myUrl');
|
$rootScope.url = $sce.trustAsUrl('http://example.com/myUrl');
|
||||||
expect($rootScope.$digest).toThrow();
|
expect(function() { $rootScope.$digest(); }).toThrowMinErr(
|
||||||
|
'$sce', 'insecurl',
|
||||||
|
/Blocked loading resource from url not allowed by \$sceDelegate policy. URL: http:\/\/example.com\/myUrl.*/);
|
||||||
jqLite(document.body).html('');
|
jqLite(document.body).html('');
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
it('should remove previously included text if a falsy value is bound to src', inject(
|
it('should remove previously included text if a falsy value is bound to src', inject(
|
||||||
putIntoCache('myUrl', '{{name}}'),
|
putIntoCache('myUrl', '{{name}}'),
|
||||||
function($rootScope, $compile) {
|
function($rootScope, $compile) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue