Skip to content

Commit 964e924

Browse files
committed
Add tests for import() about named chunk.
1 parent c7b932b commit 964e924

4 files changed

Lines changed: 43 additions & 0 deletions

File tree

test/cases/chunks/named-chunks/empty2.js

Whitespace-only changes.

test/cases/chunks/named-chunks/empty3.js

Whitespace-only changes.

test/cases/chunks/named-chunks/empty4.js

Whitespace-only changes.

test/cases/chunks/named-chunks/index.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,46 @@ it("should handle empty named chunks", function(done) {
3333
sync = false;
3434
});
3535
});
36+
37+
it("should be able to use named chunks in import()", function(done) {
38+
var sync = false;
39+
import("./empty?e" /* webpackChunkName = "import-named-chunk" */).then(function(result){
40+
import("./empty?f" /* webpackChunkName = "import-named-chunk" */).then(function(result){
41+
sync.should.be.ok();
42+
}).catch(function(err){
43+
done(err);
44+
});
45+
import("./empty?g" /* webpackChunkName = "import-named-chunk-2" */).then(function(result){
46+
sync.should.not.be.ok();
47+
done();
48+
}).catch(function(err){
49+
done(err);
50+
});
51+
sync = true;
52+
Promise.resolve().then(function(){}).then(function(){}).then(function(){
53+
sync = false;
54+
});
55+
});
56+
});
57+
58+
it("should be able to use named chunk in context import()", function(done) {
59+
var mpty = "mpty";
60+
var sync = false;
61+
import("./e" + mpty + "2" /* webpackChunkName = "context-named-chunk" */).then(function(result) {
62+
import("./e" + mpty + "3" /* webpackChunkName = "context-named-chunk" */).then(function(result){
63+
sync.should.be.ok();
64+
}).catch(function(err){
65+
done(err);
66+
});
67+
import("./e" + mpty + "4" /* webpackChunkName = "context-named-chunk-2" */).then(function(result){
68+
sync.should.not.be.ok();
69+
done();
70+
}).catch(function(err){
71+
done(err);
72+
});
73+
sync = true;
74+
Promise.resolve().then(function(){}).then(function(){}).then(function(){
75+
sync = false;
76+
});
77+
});
78+
});

0 commit comments

Comments
 (0)