Skip to content

Commit 5546272

Browse files
authored
chore: test component exports + async (#17241)
Regression-test, this works already. Closes #16657
1 parent 52a36bd commit 5546272

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<script>
2+
export function foo() {
3+
console.log('foo');
4+
}
5+
6+
const value = await Promise.resolve('bar');
7+
8+
export const bar = () => console.log(value);
9+
</script>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { tick } from 'svelte';
2+
import { test } from '../../test';
3+
4+
export default test({
5+
async test({ assert, target, logs }) {
6+
await tick();
7+
const [log] = target.querySelectorAll('button');
8+
9+
log.click();
10+
assert.deepEqual(logs, ['foo', 'bar']);
11+
}
12+
});
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<script>
2+
import Child from './Child.svelte';
3+
4+
let child;
5+
</script>
6+
7+
<Child bind:this={child} />
8+
<button onclick={() => {
9+
child.foo();
10+
child.bar();
11+
}}>log</button>

0 commit comments

Comments
 (0)