Skip to content

Commit 68d37ff

Browse files
committed
e2e test for modal example
1 parent d4bf067 commit 68d37ff

File tree

2 files changed

+27
-3
lines changed

2 files changed

+27
-3
lines changed

examples/modal/index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
</head>
99
<body>
1010
<!-- template for the modal component -->
11-
<template id="modal-template">
11+
<script type="x/template" id="modal-template">
1212
<div class="modal-mask" v-show="show" v-transition="modal">
1313
<div class="modal-wrapper">
1414
<div class="modal-container">
@@ -34,7 +34,7 @@
3434
</div>
3535
</div>
3636
</div>
37-
</template>
37+
</script>
3838

3939
<script>
4040
// register modal component
@@ -52,7 +52,7 @@
5252

5353
<!-- app -->
5454
<div id="app">
55-
<button v-on="click: showModal = true">Show Modal</button>
55+
<button id="show-modal" v-on="click: showModal = true">Show Modal</button>
5656
<!-- use the modal component, pass in the prop -->
5757
<modal show="{{@showModal}}">
5858
<!--

test/e2e/modal.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
casper.test.begin('modal', 8, function (test) {
2+
3+
casper
4+
.start('../../examples/modal/index.html')
5+
.then(function () {
6+
test.assertNotVisible('.modal-mask')
7+
})
8+
.thenClick('#show-modal', function () {
9+
test.assertVisible('.modal-mask')
10+
test.assertVisible('.modal-wrapper')
11+
test.assertVisible('.modal-container')
12+
test.assertSelectorHasText('.modal-header h3', 'custom header')
13+
test.assertSelectorHasText('.modal-body', 'default body')
14+
test.assertSelectorHasText('.modal-footer', 'default footer')
15+
})
16+
.thenClick('.modal-default-button', function () {
17+
test.assertNotVisible('.modal-mask')
18+
})
19+
// run
20+
.run(function () {
21+
test.done()
22+
})
23+
24+
})

0 commit comments

Comments
 (0)