-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsvg.js
59 lines (56 loc) · 1.82 KB
/
svg.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/* global stats, valueToPoint */
casper.test.begin('svg', 18, function (test) {
casper
.start('../../examples/svg/index.html')
.then(function () {
test.assertElementCount('g', 1)
test.assertElementCount('polygon', 1)
test.assertElementCount('circle', 1)
test.assertElementCount('text', 6)
test.assertElementCount('label', 6)
test.assertElementCount('button', 7)
test.assertElementCount('input[type="range"]', 6)
test.assertEval(function () {
var points = stats.map(function (stat, i) {
var point = valueToPoint(stat.value, i, 6)
return point.x + ',' + point.y
}).join(' ')
return document.querySelector('polygon').attributes[0].value === points
})
})
.thenClick('button', function () {
test.assertElementCount('text', 5)
test.assertElementCount('label', 5)
test.assertElementCount('button', 6)
test.assertElementCount('input[type="range"]', 5)
test.assertEval(function () {
var points = stats.map(function (stat, i) {
var point = valueToPoint(stat.value, i, 5)
return point.x + ',' + point.y
}).join(' ')
return document.querySelector('polygon').attributes[0].value === points
})
})
.then(function () {
this.fill('#add', {
newlabel: 'hi'
})
})
.thenClick('#add > button', function () {
test.assertElementCount('text', 6)
test.assertElementCount('label', 6)
test.assertElementCount('button', 7)
test.assertElementCount('input[type="range"]', 6)
test.assertEval(function () {
var points = stats.map(function (stat, i) {
var point = valueToPoint(stat.value, i, 6)
return point.x + ',' + point.y
}).join(' ')
return document.querySelector('polygon').attributes[0].value === points
})
})
// run
.run(function () {
test.done()
})
})