Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 4ef898e

Browse files
committed
test($parse): ensure CSP code paths are used when testing
Previously, the test suite was not actually taking CSP-mode paths when we were expecting it to.
1 parent 6d12e89 commit 4ef898e

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

test/ng/parseSpec.js

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -206,17 +206,13 @@ describe('parser', function() {
206206

207207
describe('csp: ' + cspEnabled + ", unwrapPromises: " + unwrapPromisesEnabled, function() {
208208

209-
var originalSecurityPolicy;
210-
211-
212-
beforeEach(function() {
213-
originalSecurityPolicy = window.document.securityPolicy;
214-
window.document.securityPolicy = {isActive : cspEnabled};
215-
});
209+
beforeEach(module(function($provide) {
210+
$provide.decorator('$sniffer', function($delegate) {
211+
$delegate.csp = cspEnabled;
212+
return $delegate;
213+
});
214+
}, provideLog));
216215

217-
afterEach(function() {
218-
window.document.securityPolicy = originalSecurityPolicy;
219-
});
220216

221217
beforeEach(module(function ($parseProvider, $provide) {
222218
$parseProvider.unwrapPromises(unwrapPromisesEnabled);

0 commit comments

Comments
 (0)