mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Transitioning to tag-intersection route (#23931)
…didn't correctly update location query params.
A followup to 1df3ccc903 (things broke after merging `main` to PR's branch)
This commit is contained in:
34
spec/system/tags_intersection_spec.rb
Normal file
34
spec/system/tags_intersection_spec.rb
Normal file
@@ -0,0 +1,34 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
describe "Tags intersection", type: :system do
|
||||
let(:discovery) { PageObjects::Pages::Discovery.new }
|
||||
|
||||
fab!(:category) { Fabricate(:category, name: "fruits") }
|
||||
fab!(:some_topic) { Fabricate(:topic, category: category) }
|
||||
|
||||
fab!(:tag) { Fabricate(:tag, name: "sour") }
|
||||
fab!(:tag2) { Fabricate(:tag, name: "tangy") }
|
||||
fab!(:some_topic) { Fabricate(:topic, tags: [tag, tag2]) }
|
||||
|
||||
fab!(:the_topic) { Fabricate(:topic, category: category, tags: [tag, tag2]) }
|
||||
|
||||
it "filters by category" do
|
||||
visit("/tags/intersection/sour/tangy?category=fruits")
|
||||
|
||||
expect(page).to have_current_path("/tags/intersection/sour/tangy?category=fruits")
|
||||
expect(discovery.topic_list).to have_topic(the_topic)
|
||||
expect(discovery.topic_list).to have_topics(count: 1)
|
||||
|
||||
visit("/")
|
||||
|
||||
# Confirm that frontend transitions work as well,
|
||||
# even though UI doesn't support that
|
||||
page.execute_script <<~JS
|
||||
require("discourse/lib/url").default.routeTo("/tags/intersection/sour/tangy?category=fruits")
|
||||
JS
|
||||
|
||||
expect(page).to have_current_path("/tags/intersection/sour/tangy?category=fruits")
|
||||
expect(discovery.topic_list).to have_topic(the_topic)
|
||||
expect(discovery.topic_list).to have_topics(count: 1)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user