forked from danlucraft/redcar
/
replace.feature
114 lines (101 loc) · 5.2 KB
/
replace.feature
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
@speedbar
Feature: Replace in file
Background:
Given I open a new edit tab
Scenario: Open replace speedbar
When I replace the contents with "Foo\nBar\nBaz"
And I move the cursor to 0
And I run the command DocumentSearch::SearchAndReplaceCommand
Then the DocumentSearch::SearchAndReplaceSpeedbar speedbar should be open
Scenario: Replace next occurrence on the same line
When I replace the contents with "Foo\nBar Rab Rab\nBaz"
And I move the cursor to 4
And I run the command DocumentSearch::SearchAndReplaceCommand
And I type "Rab" into the "Search" field in the speedbar
And I type "RAB" into the "Replace" field in the speedbar
And I press "Replace" in the speedbar
Then the contents should be "Foo\nBar RAB Rab\nBaz"
And the selected text should be "RAB"
And the selection range should be from 8 to 11
Scenario: Replace next occurrence on the same line twice
When I replace the contents with "Foo\nBar Rab Rab\nBaz"
And I move the cursor to 4
And I run the command DocumentSearch::SearchAndReplaceCommand
And I type "Rab" into the "Search" field in the speedbar
And I type "RAB" into the "Replace" field in the speedbar
And I press "Replace" in the speedbar
And I press "Replace" in the speedbar
Then the contents should be "Foo\nBar RAB RAB\nBaz"
And the selected text should be "RAB"
And the selection range should be from 12 to 15
Scenario: Replace next occurrence
When I replace the contents with "Foo\nBar\nBaz\nBar\nQux"
And I move the cursor to 0
And I run the command DocumentSearch::SearchAndReplaceCommand
And I type "Bar" into the "Search" field in the speedbar
And I type "Rab" into the "Replace" field in the speedbar
And I press "Replace" in the speedbar
Then the contents should be "Foo\nRab\nBaz\nBar\nQux"
And the selected text should be "Rab"
And the selection should be on line 1
Scenario: Replace next occurrence twice
When I replace the contents with "Foo\nBar\nBaz\nBar\nQux"
And I move the cursor to 0
And I run the command DocumentSearch::SearchAndReplaceCommand
And I type "Bar" into the "Search" field in the speedbar
And I type "Rab" into the "Replace" field in the speedbar
And I press "Replace" in the speedbar
Then the contents should be "Foo\nRab\nBaz\nBar\nQux"
When I press "Replace" in the speedbar
Then the contents should be "Foo\nRab\nBaz\nRab\nQux"
And the selected text should be "Rab"
And the selection should be on line 3
Scenario: Replace next occurrence wraps
When I replace the contents with "Foo\nBar\nBaz"
And I move the cursor to 8
And I run the command DocumentSearch::SearchAndReplaceCommand
And I type "Bar" into the "Search" field in the speedbar
And I type "Rab" into the "Replace" field in the speedbar
When I press "Replace" in the speedbar
Then the contents should be "Foo\nRab\nBaz"
And the selected text should be "Rab"
Scenario: Replace all replaces one
When I replace the contents with "Foo\nBar\nBaz"
And I move the cursor to 0
And I run the command DocumentSearch::SearchAndReplaceCommand
And I type "Bar" into the "Search" field in the speedbar
And I type "Rab" into the "Replace" field in the speedbar
Then I should see a message box containing "Replaced 1 occurrence"
When I press "Replace All" in the speedbar
Then the contents should be "Foo\nRab\nBaz"
And the selected text should be "Rab"
And the selection should be on line 1
Scenario: Replace all replaces two
When I replace the contents with "Foo\nBar\nBaz\nBar\nQux"
And I move the cursor to 0
And I run the command DocumentSearch::SearchAndReplaceCommand
And I type "Bar" into the "Search" field in the speedbar
And I type "Rab" into the "Replace" field in the speedbar
Then I should see a message box containing "Replaced 2 occurrences"
When I press "Replace All" in the speedbar
Then the contents should be "Foo\nRab\nBaz\nRab\nQux"
And the selected text should be "Rab"
And the selection should be on line 3
Scenario: Replace next occurrence test bug
When I replace the contents with "the\n* Speedbars have access to the properties of the widgets in them."
And I move the cursor to 0
And I run the command DocumentSearch::SearchAndReplaceCommand
And I type "the" into the "Search" field in the speedbar
And I type "THE" into the "Replace" field in the speedbar
And I press "Replace" in the speedbar
Then the contents should be "THE\n* Speedbars have access to the properties of the widgets in them."
And the selection range should be from 0 to 3
And I press "Replace" in the speedbar
Then the contents should be "THE\n* Speedbars have access to THE properties of the widgets in them."
And the selection range should be from 31 to 34
And I press "Replace" in the speedbar
Then the contents should be "THE\n* Speedbars have access to THE properties of THE widgets in them."
And the selection range should be from 49 to 52
And I press "Replace" in the speedbar
Then the contents should be "THE\n* Speedbars have access to THE properties of THE widgets in THEm."
And the selection range should be from 64 to 67