11casper . test . begin ( 'Repeated Items' , 41 , function ( test ) {
22
33 casper
4- . start ( './fixtures/repeated-items.html' , function ( ) {
4+ . start ( './fixtures/repeated-items.html' )
5+ . then ( function ( ) {
56
67 // initial values
78 test . assertSelectorHasText ( '.count' , '3' )
89 test . assertSelectorHasText ( '.item:nth-child(1)' , '0 A' )
910 test . assertSelectorHasText ( '.item:nth-child(2)' , '1 B' )
1011 test . assertSelectorHasText ( '.item:nth-child(3)' , '2 C' )
1112
12- this . click ( '.push' )
13+ } )
14+ . thenClick ( '.push' , function ( ) {
1315 test . assertSelectorHasText ( '.count' , '4' )
1416 test . assertSelectorHasText ( '.item:nth-child(4)' , '3 0' )
15-
16- this . click ( '.shift' )
17+ } )
18+ . thenClick ( '.shift' , function ( ) {
1719 test . assertSelectorHasText ( '.count' , '3' )
1820 test . assertSelectorHasText ( '.item:nth-child(1)' , '0 B' )
1921 test . assertSelectorHasText ( '.item:nth-child(2)' , '1 C' )
2022 test . assertSelectorHasText ( '.item:nth-child(3)' , '2 0' )
21-
22- this . click ( '.pop' )
23+ } )
24+ . thenClick ( '.pop' , function ( ) {
2325 test . assertSelectorHasText ( '.count' , '2' )
2426 test . assertSelectorHasText ( '.item:nth-child(1)' , '0 B' )
2527 test . assertSelectorHasText ( '.item:nth-child(2)' , '1 C' )
26-
27- this . click ( '.unshift' )
28+ } )
29+ . thenClick ( '.unshift' , function ( ) {
2830 test . assertSelectorHasText ( '.count' , '3' )
2931 test . assertSelectorHasText ( '.item:nth-child(1)' , '0 1' )
3032 test . assertSelectorHasText ( '.item:nth-child(2)' , '1 B' )
3133 test . assertSelectorHasText ( '.item:nth-child(3)' , '2 C' )
32-
33- this . click ( '.splice' )
34+ } )
35+ . thenClick ( '.splice' , function ( ) {
3436 test . assertSelectorHasText ( '.count' , '4' )
3537 test . assertSelectorHasText ( '.item:nth-child(1)' , '0 1' )
3638 test . assertSelectorHasText ( '.item:nth-child(2)' , '1 2' )
3739 test . assertSelectorHasText ( '.item:nth-child(3)' , '2 3' )
3840 test . assertSelectorHasText ( '.item:nth-child(4)' , '3 C' )
39-
40- this . click ( '.remove' )
41+ } )
42+ . thenClick ( '.remove' , function ( ) {
4143 test . assertSelectorHasText ( '.count' , '3' )
4244 test . assertSelectorHasText ( '.item:nth-child(1)' , '0 1' )
4345 test . assertSelectorHasText ( '.item:nth-child(2)' , '1 2' )
4446 test . assertSelectorHasText ( '.item:nth-child(3)' , '2 3' )
45-
46- this . click ( '.replace' )
47+ } )
48+ . thenClick ( '.replace' , function ( ) {
4749 test . assertSelectorHasText ( '.count' , '3' )
4850 test . assertSelectorHasText ( '.item:nth-child(1)' , '0 1' )
4951 test . assertSelectorHasText ( '.item:nth-child(2)' , '1 2' )
5052 test . assertSelectorHasText ( '.item:nth-child(3)' , '2 4' )
51-
52- this . click ( '.reverse' )
53+ } )
54+ . thenClick ( '.reverse' , function ( ) {
5355 test . assertSelectorHasText ( '.count' , '3' )
5456 test . assertSelectorHasText ( '.item:nth-child(1)' , '0 4' )
5557 test . assertSelectorHasText ( '.item:nth-child(2)' , '1 2' )
5658 test . assertSelectorHasText ( '.item:nth-child(3)' , '2 1' )
57-
58- this . click ( '.sort' )
59+ } )
60+ . thenClick ( '.sort' , function ( ) {
5961 test . assertSelectorHasText ( '.count' , '3' )
6062 test . assertSelectorHasText ( '.item:nth-child(1)' , '0 1' )
6163 test . assertSelectorHasText ( '.item:nth-child(2)' , '1 2' )
6264 test . assertSelectorHasText ( '.item:nth-child(3)' , '2 4' )
63-
65+ } )
66+ . then ( function ( ) {
6467 // make sure things work on empty array
6568 this . click ( '.pop' )
6669 this . click ( '.pop' )
@@ -72,10 +75,11 @@ casper.test.begin('Repeated Items', 41, function (test) {
7275 this . click ( '.sort' )
7376 this . click ( '.reverse' )
7477 this . click ( '.splice' )
78+ } )
79+ . then ( function ( ) {
7580 test . assertSelectorHasText ( '.count' , '2' )
7681 test . assertSelectorHasText ( '.item:nth-child(1)' , '0 6' )
7782 test . assertSelectorHasText ( '.item:nth-child(2)' , '1 7' )
78-
7983 } )
8084 . run ( function ( ) {
8185 test . done ( )
0 commit comments