Commit eb584737 eb5847373483eff855d3fb38046f181b4e6f6c46 by Nicolas Perriault

refs #160 - minor code tweaks & cs

1 parent b66b6b90
1 per.start('tests/site/keyboard-events.html'); 1 casper.start('tests/site/keyboard-events.html');
2 2
3 casper.then(function() { 3 casper.then(function() {
4 this.test.comment('CasperUtils.keyboardEvent()'); 4 this.test.comment('CasperUtils.keyboardEvent()');
5 5
6 this.test.assert(this.keyboardEvent('keypress', '#test1', '0'), 'CasperUtils.keyboardEvent() can dispatch a keypress event'); 6 this.test.assert(this.keyboardEvent('keypress', '#test1', '0'), 'CasperUtils.keyboardEvent() can dispatch a keypress event');
7 this.test.assert(this.keyboardEvent('keydown', '#test1', '1'), 'CasperUtils.keyboardEvent() can dispatch a keydown event'); 7 this.test.assert(this.keyboardEvent('keydown', '#test1', '1'), 'CasperUtils.keyboardEvent() can dispatch a keydown event');
...@@ -11,8 +11,12 @@ casper.then(function() { ...@@ -11,8 +11,12 @@ casper.then(function() {
11 this.keyboardEvent('keydown', '#test2', 'Down'); 11 this.keyboardEvent('keydown', '#test2', 'Down');
12 12
13 var results = this.getGlobal('results'); 13 var results = this.getGlobal('results');
14 this.test.assertEvalEquals(function() {return document.querySelector('#test1').value;}, "012", 'CasperUtils.keyboardEvent() can set the value of a textarea'); 14 this.test.assertEvalEquals(function() {
15 this.test.assertEvalEquals(function() {return document.querySelector('#test2').selectedIndex;}, 3, 'CasperUtils.keyboardEvent() can update the value of a select'); 15 return document.querySelector('#test1').value;
16 }, "012", 'CasperUtils.keyboardEvent() can set the value of a textarea');
17 this.test.assertEvalEquals(function() {
18 return document.querySelector('#test2').selectedIndex;
19 }, 3, 'CasperUtils.keyboardEvent() can update the value of a select');
16 }); 20 });
17 21
18 casper.run(function() { 22 casper.run(function() {
......