refs #160 - minor code tweaks & cs
Showing
1 changed file
with
8 additions
and
4 deletions
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() { | ... | ... |
-
Please register or sign in to post a comment