Skip to content

Commit

Permalink
failing test for #561
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris committed May 4, 2017
1 parent 3a7f7e2 commit b557976
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
6 changes: 6 additions & 0 deletions test/runtime/samples/component-yield-placement/Modal.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<div class='modal-background' on:click='destroy()'></div>

<div class='modal'>
{{yield}}
<button on:click='destroy()'>close modal</button>
</div>
25 changes: 25 additions & 0 deletions test/runtime/samples/component-yield-placement/_config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
export default {
data: {
showModal: true
},

html: `
<div class='modal-background'></div>
<div class='modal'>
<h2>Hello!</h2>
<button>close modal</button>
</div>
`,

test ( assert, component, target, window ) {
const button = target.querySelector( 'button' );
const click = new window.MouseEvent( 'click' );

button.dispatchEvent( click );

assert.htmlEqual( target.innerHTML, `
<button>show modal</button>
`);
}
};
15 changes: 15 additions & 0 deletions test/runtime/samples/component-yield-placement/main.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{{#if showModal}}
<Modal on:destroy='set({ showModal: false })'>
<h2>Hello!</h2>
</Modal>
{{else}}
<button on:click='set({ showModal: true })'>show modal</button>
{{/if}}

<script>
import Modal from './Modal.html';

export default {
components: { Modal }
};
</script>

0 comments on commit b557976

Please sign in to comment.