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