-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8138627
commit 6437d7b
Showing
2 changed files
with
55 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
let fulfil; | ||
|
||
let promise = new Promise(f => { | ||
fulfil = f; | ||
}); | ||
|
||
export default { | ||
solo: 1, | ||
data: { | ||
promise | ||
}, | ||
|
||
html: ` | ||
<p>loading...</p> | ||
`, | ||
|
||
test(assert, component, target) { | ||
fulfil(42); | ||
|
||
return promise | ||
.then(() => { | ||
assert.htmlEqual(target.innerHTML, ` | ||
<p>loaded</p> | ||
`); | ||
|
||
promise = new Promise((f, r) => { | ||
fulfil = f; | ||
}); | ||
|
||
component.set({ | ||
promise | ||
}); | ||
|
||
assert.htmlEqual(target.innerHTML, ` | ||
<p>loading...</p> | ||
`); | ||
|
||
fulfil(43); | ||
|
||
return promise.then(() => {}); | ||
}) | ||
.then(() => { | ||
assert.htmlEqual(target.innerHTML, ` | ||
<p>loaded</p> | ||
`); | ||
}); | ||
} | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{#await promise} | ||
<p>loading...</p> | ||
{:then value} | ||
<p>loaded</p> | ||
{:catch error} | ||
<p>errored</p> | ||
{/await} |