Skip to content

Commit

Permalink
Deny tag argument for ActionList headings (#1871)
Browse files Browse the repository at this point in the history
  • Loading branch information
camertron authored Mar 8, 2023
1 parent 0dbba6b commit 6b1170a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/seven-tables-applaud.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/view-components': patch
---

Deny tag argument for ActionList headings
2 changes: 1 addition & 1 deletion app/components/primer/alpha/action_list/heading.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def initialize(list_id:, title:, heading_level: 3, scheme: DEFAULT_SCHEME, subti

@heading_level = heading_level
@tag = :"h#{heading_level}"
@system_arguments = system_arguments
@system_arguments = deny_tag_argument(**system_arguments)
@list_id = list_id
@title = title
@subtitle = subtitle
Expand Down
10 changes: 10 additions & 0 deletions test/components/alpha/action_list_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,16 @@ def test_renders_leading_visuals

assert_selector(".ActionListItem-visual--leading", count: 2)
end

def test_heading_denies_tag_argument
error = assert_raises ArgumentError do
render_inline(Primer::Alpha::ActionList.new(aria: { lable: "List" })) do |component|
component.with_heading(title: "Foo", tag: :foo)
end
end

assert_match(/This component has a fixed tag/, error.message)
end
end
end
end

0 comments on commit 6b1170a

Please sign in to comment.