Merge pull request #5788 from AugierLe42e/fix-search-element-selection
Fixes #5787
This commit is contained in:
commit
0856eb8f86
3 changed files with 46 additions and 2 deletions
|
|
@ -58,11 +58,13 @@ app.views.Search = app.views.Base.extend({
|
|||
},
|
||||
|
||||
selectItemCallback: function(evt, data, formatted){
|
||||
var self = this.context;
|
||||
|
||||
if(data.search === true){
|
||||
window.location = this.searchFormAction + '?' + this.searchInputName + '=' + data.name;
|
||||
window.location = self.searchFormAction + '?' + self.searchInputName + '=' + data.name;
|
||||
}
|
||||
else{ // The actual result
|
||||
this.options.element.val(formatted);
|
||||
self.options.element.val(formatted);
|
||||
window.location = data.url ? data.url : '/tags/' + data.name.substring(1);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
33
features/desktop/search.feature
Normal file
33
features/desktop/search.feature
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
@javascript
|
||||
Feature: search for users and hashtags
|
||||
In order to find my friends on diaspora
|
||||
As a user
|
||||
I want search for them
|
||||
|
||||
Background:
|
||||
Given following users exist:
|
||||
| username | email |
|
||||
| Bob Jones | bob@bob.bob |
|
||||
| Alice Smith | alice@alice.alice |
|
||||
And I sign in as "bob@bob.bob"
|
||||
|
||||
Scenario: search for a user and go to its profile
|
||||
When I enter "Alice Sm" in the search input
|
||||
Then I should see "Alice Smith" within ".ac_results"
|
||||
|
||||
When I click on the first search result
|
||||
Then I should see "Alice Smith" within ".profile_header #name"
|
||||
|
||||
Scenario: search for a inexistent user and go to the search page
|
||||
When I enter "Trinity" in the search input
|
||||
Then I should see "Search for Trinity" within ".ac_even"
|
||||
|
||||
When I click on the first search result
|
||||
Then I should see "Users matching Trinity" within "#search_title"
|
||||
|
||||
Scenario: search for a tag
|
||||
When I enter "#Matrix" in the search input
|
||||
Then I should see "#matrix" within ".ac_even"
|
||||
|
||||
When I click on the first search result
|
||||
Then I should be on the tag page for "matrix"
|
||||
9
features/step_definitions/search_steps.rb
Normal file
9
features/step_definitions/search_steps.rb
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
When /^I enter "([^"]*)" in the search input$/ do |search_term|
|
||||
fill_in "q", :with => search_term
|
||||
end
|
||||
|
||||
When /^I click on the first search result$/ do
|
||||
within(".ac_results") do
|
||||
find("li", match: :first).click
|
||||
end
|
||||
end
|
||||
Loading…
Reference in a new issue