1# vim: ft=cucumber fileencoding=utf-8 sts=4 sw=4 et:
2
3Feature: Caret mode
4    In caret mode, the user can select and yank text using the keyboard.
5
6    Background:
7        Given I open data/caret.html
8        And I run :tab-only
9        And I also run :mode-enter caret
10
11    # :yank selection
12
13    Scenario: :yank selection without selection
14        When I run :yank selection
15        Then the message "Nothing to yank" should be shown.
16
17    Scenario: :yank selection message
18        When I run :selection-toggle
19        And I run :move-to-end-of-word
20        And I run :yank selection
21        Then the message "3 chars yanked to clipboard" should be shown.
22
23    Scenario: :yank selection message with one char
24        When I run :selection-toggle
25        And I run :move-to-next-char
26        And I run :yank selection
27        Then the message "1 char yanked to clipboard" should be shown.
28
29    Scenario: :yank selection with primary selection
30        When selection is supported
31        And I run :selection-toggle
32        And I run :move-to-end-of-word
33        And I run :yank selection --sel
34        Then the message "3 chars yanked to primary selection" should be shown.
35        And the primary selection should contain "one"
36
37    Scenario: :yank selection with --keep
38        When I run :selection-toggle
39        And I run :move-to-end-of-word
40        And I run :yank selection --keep
41        And I run :move-to-end-of-word
42        And I run :yank selection --keep
43        Then the message "3 chars yanked to clipboard" should be shown.
44        And the message "7 chars yanked to clipboard" should be shown.
45        And the clipboard should contain "one two"
46
47    # :selection-follow
48
49    Scenario: :selection-follow with --tab (with JS)
50        When I set content.javascript.enabled to true
51        And I run :tab-only
52        And I run :mode-enter caret
53        And I run :selection-toggle
54        And I run :move-to-end-of-word
55        And I run :selection-follow --tab
56        Then data/hello.txt should be loaded
57        And the following tabs should be open:
58            - data/caret.html
59            - data/hello.txt (active)
60
61    Scenario: :selection-follow with --tab (without JS)
62        When I set content.javascript.enabled to false
63        And I run :tab-only
64        And I run :mode-enter caret
65        And I run :selection-toggle
66        And I run :move-to-end-of-word
67        And I run :selection-follow --tab
68        Then data/hello.txt should be loaded
69        And the following tabs should be open:
70            - data/caret.html
71            - data/hello.txt
72
73    @flaky
74    Scenario: :selection-follow with link tabbing (without JS)
75        When I set content.javascript.enabled to false
76        And I run :mode-leave
77        And I run :jseval document.activeElement.blur();
78        And I run :fake-key <tab>
79        And I run :selection-follow
80        Then data/hello.txt should be loaded
81
82    @flaky
83    Scenario: :selection-follow with link tabbing (with JS)
84        When I set content.javascript.enabled to true
85        And I run :mode-leave
86        And I run :jseval document.activeElement.blur();
87        And I run :fake-key <tab>
88        And I run :selection-follow
89        Then data/hello.txt should be loaded
90
91    @flaky
92    Scenario: :selection-follow with link tabbing in a tab (without JS)
93        When I set content.javascript.enabled to false
94        And I run :mode-leave
95        And I run :jseval document.activeElement.blur();
96        And I run :fake-key <tab>
97        And I run :selection-follow --tab
98        Then data/hello.txt should be loaded
99
100    @flaky
101    Scenario: :selection-follow with link tabbing in a tab (with JS)
102        When I set content.javascript.enabled to true
103        And I run :mode-leave
104        And I run :jseval document.activeElement.blur();
105        And I run :fake-key <tab>
106        And I run :selection-follow --tab
107        Then data/hello.txt should be loaded
108