mirror of https://github.com/sveltejs/svelte
parent
f805a2cdc5
commit
709b4d30ff
@ -0,0 +1,7 @@
|
||||
<script>
|
||||
let text = 'Hello World';
|
||||
export function updateText() {
|
||||
text = 'Bye World';
|
||||
}
|
||||
</script>
|
||||
{text}
|
@ -0,0 +1,20 @@
|
||||
export default {
|
||||
html: `
|
||||
<button>Click Me</button>
|
||||
Hello World
|
||||
`,
|
||||
async test({ assert, component, target, window }) {
|
||||
const button = target.querySelector('button');
|
||||
|
||||
const event = new window.MouseEvent('click');
|
||||
|
||||
await button.dispatchEvent(event);
|
||||
assert.htmlEqual(
|
||||
target.innerHTML,
|
||||
`
|
||||
<button>Click Me</button>
|
||||
Bye World
|
||||
`
|
||||
);
|
||||
},
|
||||
};
|
@ -0,0 +1,8 @@
|
||||
<script>
|
||||
import Nested from './Nested.svelte';
|
||||
let nested;
|
||||
</script>
|
||||
|
||||
<button on:click={nested && nested.updateText}>Click Me</button>
|
||||
|
||||
<Nested bind:this={nested} />
|
Loading…
Reference in new issue