mirror of https://github.com/sveltejs/svelte
Merge pull request #921 from sveltejs/gh-917
check component exists after _bind before continuingpull/933/head
commit
0a4e795498
@ -0,0 +1 @@
|
||||
<button on:click="set({show:false})">Hide</button>
|
@ -0,0 +1,27 @@
|
||||
export default {
|
||||
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