0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-08 17:53:55 +08:00
discourse/spec/system/mobile_mode_spec.rb
David Taylor 45535887f1
Revert "FEATURE: discourse-workflows (#39704)" (#40366)
This reverts commit 9f4d1b5f61.

This merge unintentionally included a number of unrelated changes.
Reverting while we investigate what happened.
2026-05-28 13:59:42 +01:00

47 lines
1.5 KiB
Ruby
Vendored

# frozen_string_literal: true
RSpec.describe "Viewport-based mobile mode" do
it "has both stylesheets, and updates classes at runtime" do
visit "/"
mobile_stylesheet = find("link[rel=stylesheet][href*='stylesheets/mobile']", visible: false)
desktop_stylesheet = find("link[rel=stylesheet][href*='stylesheets/desktop']", visible: false)
expect(mobile_stylesheet["media"]).to include("width < 40rem")
expect(desktop_stylesheet["media"]).to include("width >= 40rem")
expect(page).to have_css("html.desktop-view")
expect(page).not_to have_css("html.mobile-view")
resize_window(width: 400) do
expect(page).to have_css("html.mobile-view")
expect(page).not_to have_css("html.desktop-view")
end
end
context "when resizing viewport while on a topic page" do
fab!(:topic)
fab!(:post) { Fabricate(:post, topic:) }
it "handles navigation after resize from mobile to desktop" do
resize_window(width: 400) do
visit "/t/#{topic.slug}/#{topic.id}"
expect(page).to have_css("html.mobile-view")
end
click_logo
expect(page).to have_css(".topic-list")
end
it "handles navigation after resize from desktop to mobile" do
visit "/t/#{topic.slug}/#{topic.id}"
expect(page).to have_css("html.desktop-view")
resize_window(width: 400) do
expect(page).to have_css("html.mobile-view")
click_logo
expect(page).to have_css(".topic-list")
end
end
end
end