Logo: Relish

  1. Sign in

Project: Redcar

Search in file

  • @speedbar
Background
Given
I open a new edit tab
Scenarios
Open search speedbar
When
I replace the contents with "Foo\nBar\nBaz"
And
I move the cursor to 0
And
I run the command DocumentSearch::SearchForwardCommand
Then
the DocumentSearch::SearchSpeedbar speedbar should be open
Search for a word should select next occurrence
When
I replace the contents with "Foo\nBar\nBaz"
And
I move the cursor to 0
And
I run the command DocumentSearch::SearchForwardCommand
And
I type "Bar" into the "Search" field in the speedbar
Then
the selected text should be "Bar"
Search twice should move to the next occurrence
When
I replace the contents with "Foo\nBar\nFoo"
And
I move the cursor to 0
And
I run the command DocumentSearch::SearchForwardCommand
And
I type "Foo" into the "Search" field in the speedbar
Then
the selection should be on line 0
When
I press "Search" in the speedbar
Then
the selected text should be "Foo"
And
the selection should be on line 2
Search should incrementally update
When
I replace the contents with "Foo\nBaar\nBaaz"
And
I move the cursor to 0
And
I run the command DocumentSearch::SearchForwardCommand
And
I type "Ba" into the "Search" field in the speedbar
Then
the selected text should be "Ba"
And
the selection should be on line 1
When
I type "Baa" into the "Search" field in the speedbar
And
the selection should be on line 1
When
I type "Baaz" into the "Search" field in the speedbar
Then
the selected text should be "Baaz"
And
the selection should be on line 2
When
I type "Baa" into the "Search" field in the speedbar
Then
the selection should be on line 2
Search for a word adjacent to cursor should select word
When
I replace the contents with "Foo\nBar\nBaz"
And
I move the cursor to 0
And
I run the command DocumentSearch::SearchForwardCommand
And
I type "Foo" into the "Search" field in the speedbar
Then
the selected text should be "Foo"
Search for a word should find occurrence after the cursor
When
I replace the contents with "Foo\nBar\nBaz\nFoo"
And
I move the cursor to 1
And
I run the command DocumentSearch::SearchForwardCommand
And
I type "Foo" into the "Search" field in the speedbar
Then
the selection should be on line 3
And
the selected text should be "Foo"
When
I press "Search" in the speedbar
Then
the selected text should be "Foo"
And
the selection should be on line 0
Search for a word should wrap to earlier occurrence if none left
When
I replace the contents with "Foo\nBar\nBaz"
And
I move the cursor to 1
And
I run the command DocumentSearch::SearchForwardCommand
And
I type "Foo" into the "Search" field in the speedbar
Then
the selected text should be "Foo"
And
the selection should be on line 0
Doesn't search for a regex by default
When
I replace the contents with "Foo\nBar\nBaz"
And
I move the cursor to 0
And
I run the command DocumentSearch::SearchForwardCommand
And
I type "Ba." into the "Search" field in the speedbar
Then
there should not be any text selected
Search for a regex
When
I replace the contents with "Foo\nBar\nBaz"
And
I move the cursor to 0
And
I run the command DocumentSearch::SearchForwardCommand
And
I type "Ba." into the "Search" field in the speedbar
And
I check "Regex" in the speedbar
Then
the selected text should be "Bar"
When
I press "Search" in the speedbar
Then
the selected text should be "Baz"
Search for a regex matches a second time
When
I replace the contents with "Foo\nBar\nBaz"
And
I move the cursor to 0
And
I run the command DocumentSearch::SearchForwardCommand
And
I type "Ba." into the "Search" field in the speedbar
When
I check "Regex" in the speedbar
Then
the selected text should be "Bar"
When
I press "Search" in the speedbar
Then
the selected text should be "Baz"
Should not match case by default
When
I replace the contents with "Foo\nBar\nBaz"
And
I move the cursor to 0
And
I run the command DocumentSearch::SearchForwardCommand
And
I type "foo" into the "Search" field in the speedbar
Then
the selected text should be "Foo"
Should match case if requested
When
I replace the contents with "Foo\nBar\nBaz"
And
I move the cursor to 0
And
I run the command DocumentSearch::SearchForwardCommand
And
I type "foo" into the "Search" field in the speedbar
And
I check "Match case" in the speedbar
Then
there should not be any text selected
Should scroll vertically to the match
When
I replace the contents with 100 lines of "xxx" then "Foo"
And
I scroll to the top of the document
And
I move the cursor to 0
And
I run the command DocumentSearch::SearchForwardCommand
And
I type "Foo" into the "Search" field in the speedbar
Then
the selected text should be "Foo"
And
line number 100 should be visible
"Should scroll horizontally to the match"
When
I replace the contents with 300 "x" then "Foo"
And
I move the cursor to 0
And
I run the command DocumentSearch::SearchForwardCommand
And
I type "Foo" into the "Search" field in the speedbar
Then
the selected text should be "Foo"
And
horizontal offset 302 should be visible
And
I run the command DocumentSearch::SearchForwardCommand
And
I type "foo" into the "Search" field in the speedbar
And
I close the speedbar
And
I run the command DocumentSearch::SearchForwardCommand
Then
the "Search" field in the speedbar should have text "foo"
And
I run the command DocumentSearch::SearchForwardCommand
And
I check "Regex" in the speedbar
And
I close the speedbar
And
I run the command DocumentSearch::SearchForwardCommand
Then
"Regex" should be checked in the speedbar
Should reopen with the same value of Regex as the previous search 2
And
I run the command DocumentSearch::SearchForwardCommand
And
I check "Regex" in the speedbar
And
I close the speedbar
And
I run the command DocumentSearch::SearchForwardCommand
And
I uncheck "Regex" in the speedbar
And
I close the speedbar
And
I run the command DocumentSearch::SearchForwardCommand
Then
"Regex" should not be checked in the speedbar
And
I run the command DocumentSearch::SearchForwardCommand
And
I check "Match case" in the speedbar
And
I close the speedbar
And
I run the command DocumentSearch::SearchForwardCommand
Then
"Match case" should be checked in the speedbar
Should initialize query with the currently selected text
When
I replace the contents with "Foo\nBar\nFoo"
And
I move the cursor to 0
And
I select from 0 to 3
And
I run the command DocumentSearch::SearchForwardCommand
Then
the "Search" field in the speedbar should have text "Foo"
Search for a word should start from the start of a selection
When
I replace the contents with "Foo\nBar\nBaz"
And
I select from 5 to 8
And
I run the command DocumentSearch::SearchForwardCommand
And
I type "Ba" into the "Search" field in the speedbar
Then
the selected text should be "Ba"
And
the selection should be on line 2
Should match the next occurence of the currently selected text
When
I replace the contents with "Foo\nBar\nFoo"
And
I move the cursor to 0
And
I select from 0 to 3
And
I run the command DocumentSearch::SearchForwardCommand
And
I press "Search" in the speedbar
Then
the selected text should be "Foo"
And
line number 2 should be visible

Last published over 5 years ago by danlucraft.