-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
/
index.js
23 lines (22 loc) · 1.06 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
it("should load script without crossorigin attribute", function(done) {
import("./empty?a" /* webpackChunkName: "chunk-with-crossorigin-attr" */);
// if in browser context, test that crossorigin attribute was not added.
if (typeof document !== 'undefined') {
var script = document.querySelector('script[src="js/chunk-with-crossorigin-attr.web.js"]');
script.getAttribute('crossorigin').should.be.exactly(null);
}
done();
});
it("should load script with crossorigin attribute 'anonymous'", function(done) {
var originalValue = __webpack_public_path__;
__webpack_public_path__ = 'https://example.com/';
import("./empty?b" /* webpackChunkName: "chunk-without-crossorigin-attr" */);
__webpack_public_path__ = originalValue;
// if in browser context, test that crossorigin attribute was added.
if (typeof document !== 'undefined') {
var script = document.querySelector('script[src="https://example.com/js/chunk-without-crossorigin-attr.web.js"]');
script.getAttribute('crossorigin').should.be.exactly('anonymous');
}
__webpack_public_path__ = originalValue;
done();
});