Skip to content

Commit b557976

Browse files
committed
failing test for #561
1 parent 3a7f7e2 commit b557976

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<div class='modal-background' on:click='destroy()'></div>
2+
3+
<div class='modal'>
4+
{{yield}}
5+
<button on:click='destroy()'>close modal</button>
6+
</div>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
export default {
2+
data: {
3+
showModal: true
4+
},
5+
6+
html: `
7+
<div class='modal-background'></div>
8+
9+
<div class='modal'>
10+
<h2>Hello!</h2>
11+
<button>close modal</button>
12+
</div>
13+
`,
14+
15+
test ( assert, component, target, window ) {
16+
const button = target.querySelector( 'button' );
17+
const click = new window.MouseEvent( 'click' );
18+
19+
button.dispatchEvent( click );
20+
21+
assert.htmlEqual( target.innerHTML, `
22+
<button>show modal</button>
23+
`);
24+
}
25+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{{#if showModal}}
2+
<Modal on:destroy='set({ showModal: false })'>
3+
<h2>Hello!</h2>
4+
</Modal>
5+
{{else}}
6+
<button on:click='set({ showModal: true })'>show modal</button>
7+
{{/if}}
8+
9+
<script>
10+
import Modal from './Modal.html';
11+
12+
export default {
13+
components: { Modal }
14+
};
15+
</script>

0 commit comments

Comments
 (0)