-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #257 from hpi-swt2/178-keep-search-query
Keep search query when navigating between tabs
- Loading branch information
Showing
8 changed files
with
51 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
function redirectWithQuery(path) { | ||
const query = localStorage.getItem('query') | ||
const url = path + '?query=' + (query ?? '') | ||
window.location.href = url; | ||
} | ||
|
||
window.redirectWithQuery = redirectWithQuery |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
Feature: Persist search query | ||
Background: | ||
Given a chair was created | ||
|
||
Scenario: persist search query when navigating from search to map page | ||
Given I am on the search page | ||
When I enter "Chair" | ||
And I navigate to the "Map" page | ||
Then I can still see the search query "Chair" in the search bar | ||
|
||
Scenario: show search results when navigating from map to search page | ||
Given I am on the map page | ||
When I enter "Chair" | ||
And I navigate to the "Search" page | ||
Then I can still see the search query "Chair" in the search bar | ||
Then I see Enterprise Platform and Integration Concepts in the list for exact-results |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,18 @@ | ||
When('I am on the search page') do | ||
visit search_path | ||
end | ||
|
||
When('I am on the map page') do | ||
visit map_path | ||
end | ||
|
||
When('I navigate to the {string} page') do |string| | ||
if page.has_css? "button.navbar-toggler" | ||
click_button 'toggle-navigation' | ||
end | ||
click_button string | ||
end | ||
|
||
Then('I can still see the search query {string} in the search bar') do |string| | ||
expect(page).to have_field('search', with: string) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters