Skip to content

A platform for community discussion. Free, open, simple.

DEV: add a visited link system spec (#34140)

Régis Hanol890c43810f32
diff --git a/spec/system/topic_list/glimmer_spec.rb b/spec/system/topic_list/glimmer_spec.rb
index 31f76cba655..96a87c6e470 100644
--- a/spec/system/topic_list/glimmer_spec.rb
+++ b/spec/system/topic_list/glimmer_spec.rb
@@ -140,4 +140,23 @@ describe "glimmer topic list", type: :system do
wait_for { TopicUser.exists?(topic:, user:) }
expect(TopicUser.find_by(topic:, user:).cleared_pinned_at).to_not be_nil
end
+
+ it "ensures visited topics have a different color" do
+ not_visited_topic = Fabricate(:topic)
+ Fabricate(:post, topic: not_visited_topic)
+
+ visited_topic = Fabricate(:topic)
+ Fabricate(:post, topic: visited_topic)
+
+ visit(visited_topic.url)
+
+ # Clicking the logo is "safer" than visiting /latest so the client-side
+ # app can update the visited status of the topic
+ find("#site-logo").click
+
+ visited_color = find(".topic-list .topic-list-item.visited a.title").style("color")
+ not_visited_color = find(".topic-list .topic-list-item:not(.visited) a.title").style("color")
+
+ expect(visited_color).to_not eq(not_visited_color)
+ end
end