forked from StanAngeloff/lotte
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Document_Query.input(..) to allow keyboard input.
The method can only input text at this time and cannot simulate a keypress due to a bug in WebKit. This may be a serious issue in the future if we want to be able to simulate full keyboard interactions, such as individual keys with modifiers.
- Loading branch information
1 parent
62f525d
commit 7ee969d
Showing
4 changed files
with
79 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<!doctype html> | ||
<html lang=en> | ||
<head> | ||
<meta charset=utf-8> | ||
<title>Lotte</title> | ||
</head> | ||
<body> | ||
|
||
<input type=text id=box1 value=World> | ||
<textarea id=box2>Hello | ||
World!</textarea> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
@base 'http://' + phantom.args[0] + ':' + phantom.args[1] | ||
@title 'localhost.localdomain' | ||
|
||
@open '/input.html', 'input(..) evaluates correctly', -> | ||
@describe 'should access default values', -> | ||
@assert.equal @$('#box1').value, 'World', 'expects default value in first box' | ||
@assert.equal @$('#box2').value, 'Hello\nWorld!', 'expects default value in second box' | ||
@success() | ||
@describe 'should throw when attempting to set value directly', -> | ||
@assert.throws ( => @$('#box1').value = 'knock, knock!'), /^TypeError.*getter$/, "expects .value to be read-only" | ||
@success() | ||
@describe 'should input text', -> | ||
@$('#box1').input value = 'Who are you?' | ||
@assert.equal @$('#box1').value, value, 'expects value in first box to update' | ||
@$('#box2').input value = "I am\n'John Doe'." | ||
@assert.equal @$('#box2').value, value, 'expects value in second box to update' | ||
@success() | ||
@describe 'should read and input text', -> | ||
previous = @$('#box1').value | ||
@$('#box1') | ||
.input(value = "#{previous} I am John Doe.") | ||
.contains('expects previous value in first box to persist', previous) | ||
@assert.equal @$('#box1').value, value, 'expects value in first box to update' | ||
@success() |