Update additional tests to ensure that the body element contains the correct bridge attributes

This commit is contained in:
Jay Ohms
2026-03-17 11:04:39 -04:00
parent 8920946cb2
commit 4d2866dec6
@@ -2,13 +2,13 @@ require "test_helper"
class SetPlatformTest < ActionDispatch::IntegrationTest
DESKTOP_UA = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
NATIVE_IOS_UA = "Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Hotwire Native iOS/1.0"
NATIVE_IOS_UA = "Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Hotwire Native iOS/1.0 bridge-components: [buttons overflow-menu]"
test "uses the request user agent by default" do
sign_in_as :david
get board_path(boards(:writebook)), headers: { "User-Agent" => DESKTOP_UA }
assert_match 'data-platform="desktop web"', response.body
assert_select "body[data-platform='desktop web'][data-bridge-platform=''][data-bridge-components='']"
end
test "prefers x_user_agent cookie over request user agent" do
@@ -16,6 +16,6 @@ class SetPlatformTest < ActionDispatch::IntegrationTest
cookies[:x_user_agent] = NATIVE_IOS_UA
get board_path(boards(:writebook)), headers: { "User-Agent" => DESKTOP_UA }
assert_match 'data-platform="native ios"', response.body
assert_select "body[data-platform='native ios'][data-bridge-platform='ios'][data-bridge-components='buttons overflow-menu']"
end
end