forked from vuejs/vue
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrepeated-primitive.js
37 lines (32 loc) · 1.13 KB
/
repeated-primitive.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/* global numbers */
casper.test.begin('Repeated Primitives', 8, function (test) {
casper
.start('./fixtures/repeated-primitive.html')
.then(function () {
test.assertSelectorHasText('p:nth-child(1)', '1')
test.assertSelectorHasText('p:nth-child(2)', '2')
test.assertSelectorHasText('p:nth-child(3)', 'text')
})
// click everything to test event handlers (delegated)
.thenClick('p:nth-child(1)', function () {
test.assertSelectorHasText('p:nth-child(1)', '1 modified')
})
.thenClick('p:nth-child(2)', function () {
test.assertSelectorHasText('p:nth-child(2)', '2 modified')
})
.thenClick('p:nth-child(3)', function () {
test.assertSelectorHasText('p:nth-child(3)', 'text modified')
})
// more clicks
.thenClick('p:nth-child(1)', function () {
test.assertSelectorHasText('p:nth-child(1)', '1 modified modified')
})
.then(function () {
test.assertEvalEquals(function () {
return numbers
}, ['1 modified modified', '2 modified', 'text modified'])
})
.run(function () {
test.done()
})
})