forked from sveltejs/svelte
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_config.js
45 lines (34 loc) · 788 Bytes
/
_config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
let fulfil;
let thePromise = new Promise(f => {
fulfil = f;
});
export default {
props: {
thePromise
},
html: `
<p>loading...</p>
`,
test({ assert, component, target, window }) {
fulfil(42);
return thePromise
.then(async () => {
assert.htmlEqual(target.innerHTML, `
<button>click me</button>
`);
const { button } = component;
const click = new window.MouseEvent('click');
button.dispatchEvent(click);
assert.equal(component.clicked, 42);
thePromise = Promise.resolve(43);
component.thePromise = thePromise;
return thePromise;
})
.then(() => {
const { button } = component;
const click = new window.MouseEvent('click');
button.dispatchEvent(click);
assert.equal(component.clicked, 43);
});
}
};