mirror of https://github.com/sveltejs/svelte
check component exists after _bind before continuing - fixes #917
parent
3442df92cb
commit
96428312ec
@ -0,0 +1 @@
|
||||
<button on:click="set({show:false})">Hide</button>
|
@ -0,0 +1,29 @@
|
||||
export default {
|
||||
solo: true,
|
||||
|
||||
data: {
|
||||
show: true
|
||||
},
|
||||
|
||||
html: `
|
||||
<button>Hide</button>
|
||||
`,
|
||||
|
||||
test(assert, component, target, window) {
|
||||
const click = new window.MouseEvent('click');
|
||||
|
||||
target.querySelector('button').dispatchEvent(click);
|
||||
|
||||
assert.equal(component.get('show'), false);
|
||||
assert.htmlEqual(target.innerHTML, `
|
||||
<button>Show</button>
|
||||
`);
|
||||
|
||||
target.querySelector('button').dispatchEvent(click);
|
||||
|
||||
assert.equal(component.get('show'), true);
|
||||
assert.htmlEqual(target.innerHTML, `
|
||||
<button>Hide</button>
|
||||
`);
|
||||
}
|
||||
};
|
@ -0,0 +1,14 @@
|
||||
{{#if show}}
|
||||
<Nested bind:show/>
|
||||
{{else}}
|
||||
<button on:click="set({show:true})">Show</button>
|
||||
{{/if}}
|
||||
|
||||
<script>
|
||||
import Nested from './Nested.html';
|
||||
export default {
|
||||
components: {
|
||||
Nested
|
||||
}
|
||||
};
|
||||
</script>
|
Loading…
Reference in new issue