Skip to content

Commit 2554e2b

Browse files
myabcclaude
andcommitted
Add single-line collapsed system test
Includes a workaround to force type-casting of Lookbook preview Boolean arguments. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 412e4d4 commit 2554e2b

2 files changed

Lines changed: 25 additions & 4 deletions

File tree

previews/primer/open_project/border_box/collapsible_header_preview.rb

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ def playground(
2525
title: title,
2626
description: description,
2727
count: count,
28-
collapsed: collapsed,
29-
multi_line: multi_line
28+
collapsed: coerce_bool(collapsed),
29+
multi_line: coerce_bool(multi_line)
3030
})
3131
end
3232

@@ -71,7 +71,7 @@ def with_description(multi_line: true)
7171
description: "This backlog is unique to this one-time meeting. You can drag items in and out to add or remove them from the meeting agenda.",
7272
count: nil,
7373
collapsed: false,
74-
multi_line: multi_line
74+
multi_line: coerce_bool(multi_line)
7575
}
7676
)
7777
end
@@ -87,10 +87,22 @@ def collapsed(multi_line: true)
8787
description: "This backlog is unique to this one-time meeting. You can drag items in and out to add or remove them from the meeting agenda.",
8888
count: nil,
8989
collapsed: true,
90-
multi_line: multi_line
90+
multi_line: coerce_bool(multi_line)
9191
}
9292
)
9393
end
94+
95+
private
96+
97+
# URL params are always strings; coerce to actual booleans before passing to the component.
98+
def coerce_bool(value)
99+
case value
100+
when true, false then value
101+
when "true" then true
102+
when "false" then false
103+
else false
104+
end
105+
end
94106
end
95107
end
96108
end

test/system/open_project/border_box/collapsible_header_test.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,15 @@ def test_renders_collapsed
1717
assert_no_text("This backlog is unique to this one-time meeting. You can drag items in and out to add or remove them from the meeting agenda.")
1818
end
1919

20+
def test_description_visible_when_collapsed_and_single_line
21+
visit_preview(:collapsed, module_prefix: "border_box", multi_line: false)
22+
23+
# In single-line mode, the description stays on the same row as the title
24+
# and remains visible even when collapsed (contrast with multi_line: true)
25+
assert_selector(".CollapsibleHeader-description", visible: true)
26+
assert_text("This backlog is unique to this one-time meeting.")
27+
end
28+
2029
def test_click_behaviour
2130
visit_preview(:default, module_prefix: "border_box")
2231

0 commit comments

Comments
 (0)