From f53bee9ef33a5611a6ee94e64e51a54a0908a238 Mon Sep 17 00:00:00 2001 From: Andreas Reinhold / reini Date: Tue, 15 Sep 2026 01:54:55 +0200 Subject: [PATCH] Check icon.css, shape.css and selection.css like every other stylesheet Review leftover (plan step 36): none of the three foundation/shared stylesheets was in a group dataset, so their shape, token and breakpoint rules went unchecked. icon and shape have views of their own and sit in components.css's first block, so they join ActionStylesheetsTest's dataset outright, with that file's block check narrowed to look for them there instead of the actions block. selection.css has no view (checkbox, radio and toggle each import it) and components.css never imports it directly, so it follows navigation-item.css's pattern in InputStylesheetsTest: a second, stylesheet-only dataset alongside the view-based one. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01Qwx5USif3wFFmxtHg5U1g9 --- .../Components/ActionStylesheetsTest.php | 20 +++++- .../Components/InputStylesheetsTest.php | 61 ++++++++++++------- 2 files changed, 55 insertions(+), 26 deletions(-) diff --git a/tests/Feature/Components/ActionStylesheetsTest.php b/tests/Feature/Components/ActionStylesheetsTest.php index 0652205d..eea93dd0 100644 --- a/tests/Feature/Components/ActionStylesheetsTest.php +++ b/tests/Feature/Components/ActionStylesheetsTest.php @@ -11,8 +11,16 @@ use NoNameWeb\LivewireMaterial\Tests\Support\ViewClasses; * `material.components` that imports the stylesheets of the components its view renders, writes * its values from the tokens and its breakpoints as px range queries, and is imported from the * "Actions and communication" block of components.css. + * + * `icon` and `shape` are the two foundation components (``, ``) — no group's view + * renders them exclusively, so they were in no group's dataset at all. They follow the same shape, + * token and view-class rules as every other component, so they run with this group's checks too; + * only "is imported from the actions and communication block" needs to read the two of them from + * components.css's first block ("Foundation components") instead, since that is where they sit. */ dataset('action components', [ + 'icon', + 'shape', 'loading', 'tooltip', 'badge', @@ -87,10 +95,16 @@ it('takes its values from the tokens and its breakpoints in px', function (strin } })->with('action components'); -it('is imported from the actions and communication block of components.css', function (string $name) { +it('is imported from the actions and communication block of components.css, or icon and shape from the foundation block before it', function (string $name) { $components = File::get(__DIR__.'/../../../resources/css/components.css'); - $block = substr($components, (int) strpos($components, '/* Actions and communication */')); - $block = substr($block, 0, (int) strpos($block, '/* Inputs, selection and data */')); + + if (in_array($name, ['icon', 'shape'], true)) { + $block = substr($components, (int) strpos($components, '/* Foundation components */')); + $block = substr($block, 0, (int) strpos($block, '/* Actions and communication */')); + } else { + $block = substr($components, (int) strpos($components, '/* Actions and communication */')); + $block = substr($block, 0, (int) strpos($block, '/* Inputs, selection and data */')); + } expect($block)->toContain("@import './components/{$name}.css';"); })->with('action components'); diff --git a/tests/Feature/Components/InputStylesheetsTest.php b/tests/Feature/Components/InputStylesheetsTest.php index d52410e0..024c87c2 100644 --- a/tests/Feature/Components/InputStylesheetsTest.php +++ b/tests/Feature/Components/InputStylesheetsTest.php @@ -17,27 +17,42 @@ use NoNameWeb\LivewireMaterial\Tests\Support\ViewClasses; * {name}.blade.php` file do not apply to it. It gets the three checks that do not depend on that * path below, and its own small versions of the other two. */ -dataset('input components', [ - 'form', - 'field', - 'input', - 'password', - 'textarea', - 'select', - 'file', - 'checkbox', - 'radio', - 'toggle', - 'chip', - 'chip-set', - 'choices', - 'slider', - 'search', - 'table', - 'sort-header', - 'datepicker', - 'timepicker', -]); +function inputComponents(): array +{ + return [ + 'form', + 'field', + 'input', + 'password', + 'textarea', + 'select', + 'file', + 'checkbox', + 'radio', + 'toggle', + 'chip', + 'chip-set', + 'choices', + 'slider', + 'search', + 'table', + 'sort-header', + 'datepicker', + 'timepicker', + ]; +} + +dataset('input components', inputComponents()); + +/** + * The checks that read a stylesheet alone also run on the one no view renders by itself: + * selection.css, what the checkbox, radio and switch share (its own file header names them), which + * each of their stylesheets imports. Nothing renders it directly and components.css never imports + * it either — only checkbox.css, radio.css and toggle.css do — so without this its shape and token + * rules would go unchecked, the way navigation-item.css did before NavigationStylesheetsTest.php + * picked it up. + */ +dataset('input stylesheets', [...inputComponents(), 'selection']); /** * Fails unless every media query in the stylesheet writes its lengths in px, at one of M3's four @@ -116,7 +131,7 @@ it('draws the component from a stylesheet shaped like every package stylesheet', foreach ($css->imports() as $import) { expect(is_file(dirname(ComponentStylesheet::path($name)).'/'.$import))->toBeTrue("{$name}.css imports {$import}, which does not exist"); } -})->with('input components'); +})->with('input stylesheets'); it('imports the stylesheet of every component its view renders', function (string $name) { preg_match_all('/with('input components'); +})->with('input stylesheets'); it('is imported from the inputs, selection and data block of components.css', function (string $name) { $components = File::get(__DIR__.'/../../../resources/css/components.css');