mirror of https://github.com/sveltejs/svelte
chore: test component exports + async (#17241)
Regression-test, this works already. Closes #16657pull/17245/head
parent
52a36bdb35
commit
5546272988
@ -0,0 +1,9 @@
|
|||||||
|
<script>
|
||||||
|
export function foo() {
|
||||||
|
console.log('foo');
|
||||||
|
}
|
||||||
|
|
||||||
|
const value = await Promise.resolve('bar');
|
||||||
|
|
||||||
|
export const bar = () => console.log(value);
|
||||||
|
</script>
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
import { tick } from 'svelte';
|
||||||
|
import { test } from '../../test';
|
||||||
|
|
||||||
|
export default test({
|
||||||
|
async test({ assert, target, logs }) {
|
||||||
|
await tick();
|
||||||
|
const [log] = target.querySelectorAll('button');
|
||||||
|
|
||||||
|
log.click();
|
||||||
|
assert.deepEqual(logs, ['foo', 'bar']);
|
||||||
|
}
|
||||||
|
});
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
<script>
|
||||||
|
import Child from './Child.svelte';
|
||||||
|
|
||||||
|
let child;
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<Child bind:this={child} />
|
||||||
|
<button onclick={() => {
|
||||||
|
child.foo();
|
||||||
|
child.bar();
|
||||||
|
}}>log</button>
|
||||||
Loading…
Reference in new issue