mirror of https://github.com/sveltejs/svelte
parent
04c7705e51
commit
7ef345a45b
@ -0,0 +1,6 @@
|
|||||||
|
<script>
|
||||||
|
let count = 0;
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<button on:click="{() => count += 1}">+1</button>
|
||||||
|
<slot count={count}/>
|
@ -0,0 +1,18 @@
|
|||||||
|
export default {
|
||||||
|
html: `
|
||||||
|
<button>+1</button>
|
||||||
|
<span>0</span>
|
||||||
|
`,
|
||||||
|
|
||||||
|
async test({ assert, target, window }) {
|
||||||
|
const button = target.querySelector('button');
|
||||||
|
const click = new window.MouseEvent('click');
|
||||||
|
|
||||||
|
await button.dispatchEvent(click);
|
||||||
|
|
||||||
|
assert.htmlEqual(target.innerHTML, `
|
||||||
|
<button>+1</button>
|
||||||
|
<span>1</span>
|
||||||
|
`);
|
||||||
|
}
|
||||||
|
};
|
@ -0,0 +1,7 @@
|
|||||||
|
<script>
|
||||||
|
import Nested from './Nested.html';
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<Nested let:count>
|
||||||
|
<span>{count}</span>
|
||||||
|
</Nested>
|
Loading…
Reference in new issue