1
+ casper . test . begin ( 'svg' , 18 , function ( test ) {
2
+
3
+ casper
4
+ . start ( '../../examples/svg/index.html' )
5
+ . then ( function ( ) {
6
+ test . assertElementCount ( 'g' , 1 )
7
+ test . assertElementCount ( 'polygon' , 1 )
8
+ test . assertElementCount ( 'circle' , 1 )
9
+ test . assertElementCount ( 'text' , 6 )
10
+ test . assertElementCount ( 'label' , 6 )
11
+ test . assertElementCount ( 'button' , 7 )
12
+ test . assertElementCount ( 'input[type="range"]' , 6 )
13
+ test . assertEval ( function ( ) {
14
+ var points = stats . map ( function ( stat , i ) {
15
+ var point = valueToPoint ( stat . value , i , 6 )
16
+ return point . x + ',' + point . y
17
+ } ) . join ( ' ' )
18
+ return document . querySelector ( 'polygon' ) . attributes [ 0 ] . value === points
19
+ } )
20
+ } )
21
+ . thenClick ( 'button' , function ( ) {
22
+ test . assertElementCount ( 'text' , 5 )
23
+ test . assertElementCount ( 'label' , 5 )
24
+ test . assertElementCount ( 'button' , 6 )
25
+ test . assertElementCount ( 'input[type="range"]' , 5 )
26
+ test . assertEval ( function ( ) {
27
+ var points = stats . map ( function ( stat , i ) {
28
+ var point = valueToPoint ( stat . value , i , 5 )
29
+ return point . x + ',' + point . y
30
+ } ) . join ( ' ' )
31
+ return document . querySelector ( 'polygon' ) . attributes [ 0 ] . value === points
32
+ } )
33
+ } )
34
+ . then ( function ( ) {
35
+ this . fill ( '#add' , {
36
+ newlabel : 'hi'
37
+ } )
38
+ } )
39
+ . thenClick ( '#add > button' , function ( ) {
40
+ test . assertElementCount ( 'text' , 6 )
41
+ test . assertElementCount ( 'label' , 6 )
42
+ test . assertElementCount ( 'button' , 7 )
43
+ test . assertElementCount ( 'input[type="range"]' , 6 )
44
+ test . assertEval ( function ( ) {
45
+ var points = stats . map ( function ( stat , i ) {
46
+ var point = valueToPoint ( stat . value , i , 6 )
47
+ return point . x + ',' + point . y
48
+ } ) . join ( ' ' )
49
+ return document . querySelector ( 'polygon' ) . attributes [ 0 ] . value === points
50
+ } )
51
+ } )
52
+ // run
53
+ . run ( function ( ) {
54
+ test . done ( )
55
+ } )
56
+
57
+ } )
0 commit comments