diff options
| author | Chirayu Krishnappa | 2013-09-17 16:09:29 -0700 |
|---|---|---|
| committer | Chirayu Krishnappa | 2013-09-17 16:13:25 -0700 |
| commit | 4b71bbc9886f6cf8e939d257c755bf7c4a94396e (patch) | |
| tree | dd687a1e6fc5083558c4d9354035a15d61ca8a3b /test/ng/directive/ngIncludeSpec.js | |
| parent | 265f0b52253ffe63715e69b5ba0b0092a8b1fb0f (diff) | |
| download | angular.js-4b71bbc9886f6cf8e939d257c755bf7c4a94396e.tar.bz2 | |
fix(test): fixed toThrow usage
Diffstat (limited to 'test/ng/directive/ngIncludeSpec.js')
| -rw-r--r-- | test/ng/directive/ngIncludeSpec.js | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/test/ng/directive/ngIncludeSpec.js b/test/ng/directive/ngIncludeSpec.js index f1bfbba2..ffe6a998 100644 --- a/test/ng/directive/ngIncludeSpec.js +++ b/test/ng/directive/ngIncludeSpec.js @@ -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) { element = jqLite('<ng:include src="url"></ng:include>'); jqLite(document.body).append(element); element = $compile(element)($rootScope); $rootScope.name = 'chirayu'; - $rootScope.url = 'myUrl'; - expect($rootScope.$digest).toThrow(); + $rootScope.url = 'http://example.com/myUrl'; + 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(''); })); @@ -82,11 +84,14 @@ describe('ngInclude', function() { jqLite(document.body).append(element); element = $compile(element)($rootScope); $rootScope.name = 'chirayu'; - $rootScope.url = $sce.trustAsUrl('myUrl'); - expect($rootScope.$digest).toThrow(); + $rootScope.url = $sce.trustAsUrl('http://example.com/myUrl'); + 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(''); })); + it('should remove previously included text if a falsy value is bound to src', inject( putIntoCache('myUrl', '{{name}}'), function($rootScope, $compile) { |
