Skip to content

Commit aeabf1c

Browse files
committed
Failing test for #974
1 parent 6641684 commit aeabf1c

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
let fulfil;
2+
3+
let thePromise = new Promise(f => {
4+
fulfil = f;
5+
});
6+
7+
export default {
8+
data: {
9+
thePromise
10+
},
11+
12+
html: `
13+
<div><p>loading...</p></div>
14+
`,
15+
16+
test(assert, component, target) {
17+
fulfil(42);
18+
19+
return thePromise
20+
.then(() => {
21+
assert.htmlEqual(target.innerHTML, `
22+
<div><p>the value is 42</p></div>
23+
`);
24+
25+
let reject;
26+
27+
thePromise = new Promise((f, r) => {
28+
reject = r;
29+
});
30+
31+
component.set({
32+
thePromise
33+
});
34+
35+
assert.htmlEqual(target.innerHTML, `
36+
<div><p>loading...</p></div>
37+
`);
38+
39+
reject(new Error('something broke'));
40+
41+
return thePromise.catch(() => {});
42+
})
43+
.then(() => {
44+
assert.htmlEqual(target.innerHTML, `
45+
<div><p>oh no! something broke</p></div>
46+
`);
47+
});
48+
}
49+
};
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<div>
2+
{{#await thePromise}}
3+
<p>loading...</p>
4+
{{then theValue}}
5+
<p>the value is {{theValue}}</p>
6+
{{catch theError}}
7+
<p>oh no! {{theError.message}}</p>
8+
{{/await}}
9+
</div>

0 commit comments

Comments
 (0)