Skip to content

Commit 890c438

Browse files
authored
DEV: add a visited link system spec (#34140)
That ensures visited topics have a different (font) color than not-yet visited topics in the topics lists. This might help prevent commits like f6a1648
1 parent 4217e8f commit 890c438

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

spec/system/topic_list/glimmer_spec.rb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,4 +140,23 @@
140140
wait_for { TopicUser.exists?(topic:, user:) }
141141
expect(TopicUser.find_by(topic:, user:).cleared_pinned_at).to_not be_nil
142142
end
143+
144+
it "ensures visited topics have a different color" do
145+
not_visited_topic = Fabricate(:topic)
146+
Fabricate(:post, topic: not_visited_topic)
147+
148+
visited_topic = Fabricate(:topic)
149+
Fabricate(:post, topic: visited_topic)
150+
151+
visit(visited_topic.url)
152+
153+
# Clicking the logo is "safer" than visiting /latest so the client-side
154+
# app can update the visited status of the topic
155+
find("#site-logo").click
156+
157+
visited_color = find(".topic-list .topic-list-item.visited a.title").style("color")
158+
not_visited_color = find(".topic-list .topic-list-item:not(.visited) a.title").style("color")
159+
160+
expect(visited_color).to_not eq(not_visited_color)
161+
end
143162
end

0 commit comments

Comments
 (0)