Added tests for paste-primary command

This commit is contained in:
Jakub Klinkovský 2016-01-30 13:57:26 +01:00
parent db6a0d53ca
commit b358566156
2 changed files with 60 additions and 0 deletions

View File

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Paste primary selection</title>
</head>
<body>
<textarea id="qute-textarea"></textarea>
</body>
</html>

View File

@ -170,3 +170,53 @@ Feature: Yanking and pasting.
history:
- active: true
url: http://localhost:*/data/hello3.txt
Scenario: Pasting the primary selection into an empty text field
When selection is supported
And I open data/paste_primary.html
And I put "Hello world" into the primary selection
# Click the text field
And I run :hint all
And I run :follow-hint a
And I run :paste-primary
# Compare
And I run :jseval console.log(document.getElementById('qute-textarea').value);
Then the javascript message "Hello world" should be logged
Scenario: Pasting the primary selection into a text field at specific position
When selection is supported
And I open data/paste_primary.html
And I run :jseval document.getElementById('qute-textarea').value = 'one two three four';
And I put " Hello world" into the primary selection
# Click the text field
And I run :hint all
And I run :follow-hint a
# Move to the beginning and two words to the right
And I press the keys "<Home>"
And I press the key "<Ctrl+Right>"
And I press the key "<Ctrl+Right>"
And I run :paste-primary
# Compare
And I run :jseval console.log(document.getElementById('qute-textarea').value);
Then the javascript message "one two Hello world three four" should be logged
Scenario: Pasting the primary selection into a text field with undo
When selection is supported
And I open data/paste_primary.html
And I run :jseval document.getElementById('qute-textarea').value = 'one two three four';
And I put " Hello world" into the primary selection
# Click the text field
And I run :hint all
And I run :follow-hint a
# Move to the beginning and after the first word
And I press the keys "<Home>"
And I press the key "<Ctrl+Right>"
# Paste and undo
And I run :paste-primary
And I press the key "<Ctrl+z>"
# One word to the right
And I press the key "<Ctrl+Right>"
And I run :paste-primary
# Compare
And I run :jseval console.log(document.getElementById('qute-textarea').value);
Then the javascript message "one two Hello world three four" should be logged