mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: "in posts by" user search (#27628)
When visiting a user profile, and then opening the search, there's an option to filter down by posts made by that user. When clicking that option, it used to pre-fill the "search bar" with "@<username>" to filter down the search. This restore this behaviour and add a system spec to ensure it doesn't regress. Context - https://meta.discourse.org/t/in-posts-by-search-option-does-not-work-when-clicked/312916
This commit is contained in:
parent
e92a82aa1d
commit
4a6b79dead
@ -135,6 +135,7 @@ export default class InitialOptions extends Component {
|
||||
}
|
||||
|
||||
userContextType() {
|
||||
this.contextTypeKeyword = "@";
|
||||
this.slug = `@${this.search.searchContext.user.username}`;
|
||||
this.suffix = I18n.t("search.in_posts_by", {
|
||||
username: this.search.searchContext.user.username,
|
||||
|
@ -38,6 +38,10 @@ module PageObjects
|
||||
find(".d-header #search-button").click
|
||||
end
|
||||
|
||||
def click_in_posts_by_user
|
||||
find(".search-menu-container .search-menu-assistant-item").click
|
||||
end
|
||||
|
||||
def click_first_topic
|
||||
find(".topic-list-body tr:first-of-type").click
|
||||
end
|
||||
@ -68,6 +72,14 @@ module PageObjects
|
||||
page.has_selector?(".search-results .warning")
|
||||
end
|
||||
|
||||
def has_found_no_results?
|
||||
page.has_css?(".search-menu-container .results .no-results")
|
||||
end
|
||||
|
||||
def search_term
|
||||
page.find("#search-term").value
|
||||
end
|
||||
|
||||
SEARCH_PAGE_SELECTOR = "body.search-page"
|
||||
|
||||
def active?
|
||||
|
17
spec/system/user_page/user_page_search_spec.rb
Normal file
17
spec/system/user_page/user_page_search_spec.rb
Normal file
@ -0,0 +1,17 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
describe "User page search", type: :system do
|
||||
fab!(:user)
|
||||
let(:search_page) { PageObjects::Pages::Search.new }
|
||||
|
||||
it "filters down to the user" do
|
||||
sign_in(user)
|
||||
|
||||
visit("/u/#{user.username}")
|
||||
search_page.click_search_icon
|
||||
search_page.click_in_posts_by_user
|
||||
|
||||
expect(search_page).to have_found_no_results
|
||||
expect(search_page.search_term).to eq("@#{user.username}")
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user