# frozen_string_literal: true
describe "Topic page", type: :system do
fab!(:topic) { Fabricate(:topic) }
before { Fabricate(:post, topic: topic, cooked: <<~HTML) }
x
Testing
HTML
it "allows TOC anchor navigation" do
visit("/t/#{topic.slug}/#{topic.id}")
find("#toc-h2-testing").hover
find("a.anchor").click
try_until_success(timeout: 5) do
expect(current_url).to match("/t/#{topic.slug}/#{topic.id}#toc-h2-testing")
end
end
context "with a subfolder setup" do
before { set_subfolder "/forum" }
it "allows TOC anchor navigation" do
visit("/forum/t/#{topic.slug}/#{topic.id}")
find("#toc-h2-testing").hover
find("a.anchor").click
try_until_success(timeout: 5) do
expect(current_url).to match("/forum/t/#{topic.slug}/#{topic.id}#toc-h2-testing")
end
end
end
end