From 694de540aae47e2d56eb2627fb9b22f02b86df68 Mon Sep 17 00:00:00 2001 From: Cameron Dutro Date: Tue, 1 Oct 2024 17:20:14 -0700 Subject: [PATCH] Fix component and CSS tests --- app/components/primer/alpha/stack.pcss | 32 --------------------- app/components/primer/alpha/stack_item.pcss | 31 ++++++++++++++++++++ app/components/primer/primer.pcss | 11 +++---- test/components/component_test.rb | 7 +++-- 4 files changed, 42 insertions(+), 39 deletions(-) create mode 100644 app/components/primer/alpha/stack_item.pcss diff --git a/app/components/primer/alpha/stack.pcss b/app/components/primer/alpha/stack.pcss index 3c3e5440c1..f2533c014c 100644 --- a/app/components/primer/alpha/stack.pcss +++ b/app/components/primer/alpha/stack.pcss @@ -285,36 +285,4 @@ flex-wrap: nowrap; } } -} - -.StackItem { - flex: 0 1 auto; - min-inline-size: 0; - - &[data-grow='true'], - &[data-grow-narrow='true'] { - flex-grow: 1; - } - - /* @custom-media --veiwportRange-regular */ - @media (min-width: 48rem) { - &[data-grow-regular='true'] { - flex-grow: 1; - } - - &[data-grow-regular='false'] { - flex-grow: 0; - } - } - - /* @custom-media --viewportRange-wide */ - @media (min-width: 87.5rem) { - &[data-grow-wide='true'] { - flex-grow: 1; - } - - &[data-grow-wide='false'] { - flex-grow: 0; - } - } } diff --git a/app/components/primer/alpha/stack_item.pcss b/app/components/primer/alpha/stack_item.pcss new file mode 100644 index 0000000000..423ddac251 --- /dev/null +++ b/app/components/primer/alpha/stack_item.pcss @@ -0,0 +1,31 @@ +.StackItem { + flex: 0 1 auto; + min-inline-size: 0; + + &[data-grow='true'], + &[data-grow-narrow='true'] { + flex-grow: 1; + } + + /* @custom-media --veiwportRange-regular */ + @media (min-width: 48rem) { + &[data-grow-regular='true'] { + flex-grow: 1; + } + + &[data-grow-regular='false'] { + flex-grow: 0; + } + } + + /* @custom-media --viewportRange-wide */ + @media (min-width: 87.5rem) { + &[data-grow-wide='true'] { + flex-grow: 1; + } + + &[data-grow-wide='false'] { + flex-grow: 0; + } + } +} diff --git a/app/components/primer/primer.pcss b/app/components/primer/primer.pcss index b3edab7927..b62c2a9fcd 100644 --- a/app/components/primer/primer.pcss +++ b/app/components/primer/primer.pcss @@ -4,18 +4,19 @@ @import "./alpha/action_list.pcss"; @import "./alpha/auto_complete.pcss"; @import "./alpha/banner.pcss"; +@import "./alpha/button_marketing.pcss"; @import "./alpha/dialog.pcss"; @import "./alpha/dropdown.pcss"; @import "./alpha/layout.pcss"; +@import "./alpha/menu.pcss"; +@import "./alpha/segmented_control.pcss"; +@import "./alpha/select_panel.pcss"; +@import "./alpha/stack.pcss"; +@import "./alpha/stack_item.pcss"; @import "./alpha/tab_nav.pcss"; @import "./alpha/text_field.pcss"; -@import "./alpha/button_marketing.pcss"; @import "./alpha/toggle_switch.pcss"; @import "./alpha/underline_nav.pcss"; -@import "./alpha/select_panel.pcss"; -@import "./alpha/segmented_control.pcss"; -@import "./alpha/menu.pcss"; -@import "./alpha/stack.pcss"; /* beta */ @import "./beta/avatar.pcss"; diff --git a/test/components/component_test.rb b/test/components/component_test.rb index a364ca6aee..931fa37228 100644 --- a/test/components/component_test.rb +++ b/test/components/component_test.rb @@ -129,7 +129,9 @@ class PrimerComponentTest < Minitest::Test [Primer::Alpha::Banner, {}], [Primer::Alpha::FormControl, { label: "Foo" }], [Primer::Alpha::ActionMenu, {}, proc { |component| component.with_item(label: "Do something", value: "") }], - [Primer::Alpha::SelectPanel, {}] + [Primer::Alpha::SelectPanel, {}], + [Primer::Alpha::Stack, {}], + [Primer::Alpha::StackItem, {}] ].freeze def test_registered_components @@ -155,7 +157,8 @@ def test_registered_components "Primer::Alpha::OcticonSymbols", "Primer::Component", "Primer::Content", - "Primer::Navigation::TabComponent" + "Primer::Navigation::TabComponent", + "Primer::ResponsiveArg" ] primer_component_files_count = Dir["app/components/**/*.rb"].count { |p| p.exclude?("/experimental/") }