Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: components not always initializing inside client-reorder await (#…
- Loading branch information
1 parent
0a227d0
commit da31ead
Showing
3 changed files
with
25 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 20 additions & 5 deletions
25
...es/marko/test/components-pages/fixtures/split-async-keys/components/app-hello/index.marko
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,22 @@ | ||
$ var promise = new Promise(resolve => setTimeout(resolve, 100)); | ||
<await(promise) client-reorder> | ||
<div key="div0"/> | ||
<app-child key="child0"/> | ||
|
||
<await(new Promise(resolve => setTimeout(resolve, 100))) client-reorder> | ||
<@then> | ||
<div key="div"/> | ||
<app-child key="child"/> | ||
<div key="div1"/> | ||
<app-child key="child1"/> | ||
|
||
<await(new Promise(resolve => setTimeout(resolve, 200)))> | ||
<@then> | ||
<div key="div2"/> | ||
<app-child key="child2"/> | ||
</@then> | ||
</await> | ||
|
||
<div key="div3"/> | ||
<app-child key="child3"/> | ||
</@then> | ||
</await> | ||
</await> | ||
|
||
<div key="div4"/> | ||
<app-child key="child4"/> |
6 changes: 4 additions & 2 deletions
6
packages/marko/test/components-pages/fixtures/split-async-keys/tests.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
var expect = require("chai").expect; | ||
|
||
it("should initialize components correctly across async boundaries", function(done) { | ||
expect(window.component.getEl("div")).to.not.equal(undefined); | ||
expect(window.component.getComponent("child")).to.not.equal(undefined); | ||
for (let i = 0; i <= 4; i++) { | ||
expect(window.component.getEl(`div${i}`)).to.not.equal(undefined); | ||
expect(window.component.getComponent(`child${i}`)).to.not.equal(undefined); | ||
} | ||
done(); | ||
}); |