From b358566156e446c8048849e730f643fe2ab5534e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Klinkovsk=C3=BD?= Date: Sat, 30 Jan 2016 13:57:26 +0100 Subject: [PATCH] Added tests for paste-primary command --- tests/integration/data/paste_primary.html | 10 ++++ tests/integration/features/yankpaste.feature | 50 ++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 tests/integration/data/paste_primary.html diff --git a/tests/integration/data/paste_primary.html b/tests/integration/data/paste_primary.html new file mode 100644 index 000000000..ff6e9ed54 --- /dev/null +++ b/tests/integration/data/paste_primary.html @@ -0,0 +1,10 @@ + + + + + Paste primary selection + + + + + diff --git a/tests/integration/features/yankpaste.feature b/tests/integration/features/yankpaste.feature index b09bf7ce5..33704dfc1 100644 --- a/tests/integration/features/yankpaste.feature +++ b/tests/integration/features/yankpaste.feature @@ -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 "" + And I press the key "" + And I press the key "" + 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 "" + And I press the key "" + # Paste and undo + And I run :paste-primary + And I press the key "" + # One word to the right + And I press the key "" + 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