mirror of
https://github.com/discourse/discourse.git
synced 2025-07-13 09:21:27 +08:00

Follow-up to ca658a8bb093c82410927d1fa29e5ef1940260b7 The original attempt at this wasn't flexible enough for some languages where adjectives may depend on context, so this requires more translation but allows for full context in each string Discussed here: https://meta.discourse.org/t/translating-filter-in-headings-for-discovery-routes/363520
57 lines
1.8 KiB
Ruby
57 lines
1.8 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
describe "Discovery heading accessibility", type: :system do
|
|
let(:discovery) { PageObjects::Pages::Discovery.new }
|
|
|
|
fab!(:category) { Fabricate(:category, name: "General") }
|
|
fab!(:tag) { Fabricate(:tag, name: "help") }
|
|
|
|
fab!(:topic_in_category) { Fabricate(:topic, category: category) }
|
|
fab!(:topic_with_tag) { Fabricate(:topic, tags: [tag]) }
|
|
fab!(:topic_in_category_tagged) { Fabricate(:topic, category: category, tags: [tag]) }
|
|
|
|
it "shows correct heading for category view" do
|
|
visit "/c/#{category.slug}/#{category.id}"
|
|
expect(page).to have_selector("h1", text: "Latest topics in General")
|
|
end
|
|
|
|
it "shows correct heading for tagged view" do
|
|
visit "/tags/#{tag.name}"
|
|
expect(page).to have_selector("h1", text: "Latest topics tagged help")
|
|
end
|
|
|
|
it "shows correct heading for category + tag view" do
|
|
visit "/tags/c/#{category.slug}/#{category.id}/#{tag.name}"
|
|
expect(page).to have_selector("h1", text: "Latest topics in General tagged help")
|
|
end
|
|
|
|
it "shows correct heading for no tags view" do
|
|
visit "/tag/none"
|
|
expect(page).to have_selector("h1", text: "Latest topics without tags")
|
|
end
|
|
|
|
it "shows default heading for latest topics" do
|
|
visit "/latest"
|
|
expect(page).to have_selector("h1", text: "All latest topics")
|
|
end
|
|
|
|
it "shows heading for all categories view" do
|
|
visit "/categories"
|
|
expect(page).to have_selector("h1", text: "All categories")
|
|
end
|
|
|
|
it "shows heading for bookmarked topics" do
|
|
sign_in(Fabricate(:user))
|
|
|
|
visit "/bookmarks"
|
|
expect(page).to have_selector("h1", text: "All topics you’ve bookmarked")
|
|
end
|
|
|
|
it "shows heading for posted topics" do
|
|
sign_in(Fabricate(:user))
|
|
|
|
visit "/posted"
|
|
expect(page).to have_selector("h1", text: "All topics you’ve posted in")
|
|
end
|
|
end
|