Commit 1a50e23d 1a50e23d3d92179060f6f90a94af12a98c1f34ac by Nicolas Perriault

added more waitFor* tests

1 parent 3a4ed2c8
......@@ -14,6 +14,7 @@
<div id="textChange" >
Loading...
</div>
<div id="encoded">Voil&agrave;</div>
<script>
setTimeout(function() {
var li = document.createElement('li')
......
/*global casper*/
/*jshint strict:false*/
casper.test.begin('fetchText() tests', 1, function(test) {
casper.test.begin('fetchText() basic tests', 1, function(test) {
casper.start('tests/site/index.html', function() {
test.assertEquals(this.fetchText('ul li'), 'onetwothree',
'Casper.fetchText() can retrieve text contents');
......@@ -8,3 +8,14 @@ casper.test.begin('fetchText() tests', 1, function(test) {
test.done();
});
});
casper.test.begin('fetchText() handles HTML entities', 1, function(test) {
casper.start().then(function() {
this.setContent('<html><body>Voil&agrave;</body></html>');
test.assertEquals(this.fetchText('body'), 'Voilà',
'Casper.fetchText() fetches decoded text');
});
casper.run(function() {
test.done();
});
});
......
......@@ -77,7 +77,7 @@ casper.test.begin('waitForSelector() tests', 1, function(test) {
});
});
casper.test.begin('waitForText() tests', 2, function(test) {
casper.test.begin('waitForText() tests', 4, function(test) {
casper.start('tests/site/waitFor.html');
casper.waitForText('<li>four</li>', function() {
......@@ -92,6 +92,12 @@ casper.test.begin('waitForText() tests', 2, function(test) {
test.fail('Casper.waitForText() can wait for regexp');
});
casper.reload().waitForText('Voilà', function() {
test.pass('Casper.waitForText() can wait for decoded HTML text');
}, function() {
test.fail('Casper.waitForText() can wait for decoded HTML text');
}, 1000);
casper.run(function() {
test.done();
});
......