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:
Jarek Radosz
2023-10-13 17:23:04 +02:00
committed by GitHub
parent b3df0a362b
commit a5858e60e1
3 changed files with 38 additions and 21 deletions

View 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