Skip to content

Commit 1b70d4f

Browse files
committed
add e2e tests for slider example
1 parent 4575203 commit 1b70d4f

File tree

6 files changed

+31
-4
lines changed

6 files changed

+31
-4
lines changed

examples/slider/images/arch.jpg

85.6 KB
Loading

examples/slider/images/grooves.jpg

82.3 KB
Loading

examples/slider/images/rock.jpg

62 KB
Loading

examples/slider/images/sunset.jpg

20.7 KB
Loading

examples/slider/index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@
4343
<!-- demo root element -->
4444
<div id="demo">
4545
<img-slider>
46-
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/5689/rock.jpg">
47-
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/5689/grooves.jpg">
48-
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/5689/arch.jpg">
49-
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/5689/sunset.jpg">
46+
<img src="images/rock.jpg">
47+
<img src="images/grooves.jpg">
48+
<img src="images/arch.jpg">
49+
<img src="images/sunset.jpg">
5050
</img-slider>
5151
</div>
5252

test/e2e/slider.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// PhantomJS has pretty poor CSS3 support so we're just
2+
// testing the content transclusion here
3+
4+
casper.test.begin('slider', 2, function (test) {
5+
6+
casper
7+
.start('../../examples/slider/index.html')
8+
.then(function () {
9+
test.assertElementCount('article img', 4)
10+
test.assertEval(function () {
11+
var ok = true
12+
var images = ['rock', 'grooves', 'arch', 'sunset']
13+
for (var i = 1; i < 5; i++) {
14+
var img = document.querySelector('article:nth-child(' + i + ')').children[0]
15+
if (img.src.indexOf(images[i - 1]) < 0) {
16+
ok = false
17+
}
18+
}
19+
return ok
20+
})
21+
})
22+
// run
23+
.run(function () {
24+
test.done()
25+
})
26+
27+
})

0 commit comments

Comments
 (0)