Fold the four groups' import check into one dataset over every component view
Action/Input/Containment/NavigationStylesheetsTest.php each carried the same "imports the stylesheet of every component its view renders" check on their own group's dataset. StylesheetsTest.php now runs it once, over every resources/views/components/*.blade.php backed by a stylesheet of its own (icon and shape included, no longer needing a group to run in at all; tabs/tab's shared stylesheet, N-16, still handled) — a new component gets the check by existing, not by being added to the right group's array too. Each group file keeps its own dataset for the checks that stay group-shaped (shape, tokens, breakpoints, the block it imports from). Plan step 42 (Phase F), Part A. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qwx5USif3wFFmxtHg5U1g9
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
4cf0997712
commit
34b77cfd31
@@ -7,10 +7,11 @@ use NoNameWeb\LivewireMaterial\Tests\Support\ViewClasses;
|
||||
/**
|
||||
* The actions and communication components, rewritten without Tailwind (plan step 36): each view
|
||||
* renders `data-md-*` attributes and no class list of its own beyond the interaction and text
|
||||
* classes (tests/Support/ViewClasses.php), and each has a stylesheet in
|
||||
* `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 all.css.
|
||||
* classes (tests/Support/ViewClasses.php), writes its values from the tokens and its breakpoints
|
||||
* as px range queries, and is imported from the "Actions and communication" block of all.css.
|
||||
* Every component stylesheet importing the stylesheets its view renders is
|
||||
* tests/Feature/StylesheetsTest.php's now, folded into one dataset over every component view (step
|
||||
* 42) rather than kept once per group.
|
||||
*
|
||||
* `icon` and `shape` are the two foundation components (`<x-icon>`, `<x-shape>`) — no group's view
|
||||
* renders them exclusively, so they were in no group's dataset at all. They follow the same shape,
|
||||
@@ -57,20 +58,6 @@ it('draws the component from a stylesheet shaped like every package stylesheet',
|
||||
}
|
||||
})->with('action components');
|
||||
|
||||
it('imports the stylesheet of every component its view renders', function (string $name) {
|
||||
preg_match_all('/<x-livewire-material::([a-z-]+)/', File::get(__DIR__."/../../../resources/views/components/{$name}.blade.php"), $tags);
|
||||
|
||||
$rendered = collect($tags[1])->unique()
|
||||
// A rendered tag that is not a components/ stylesheet at all (a layout component's, e.g.
|
||||
// <x-pane>) has no import of its own to check here.
|
||||
->filter(fn (string $tag): bool => is_file(ComponentStylesheet::path($tag)) && str_contains(File::get(ComponentStylesheet::path($tag)), '@layer material.components'))
|
||||
->map(fn (string $tag): string => "./{$tag}.css")
|
||||
->values()
|
||||
->all();
|
||||
|
||||
expect(array_values(array_diff($rendered, ComponentStylesheet::read($name)->imports())))->toBe([]);
|
||||
})->with('action components');
|
||||
|
||||
it('writes no class list into the view but the interaction and text classes', function (string $name) {
|
||||
expect(ViewClasses::violations(File::get(__DIR__."/../../../resources/views/components/{$name}.blade.php")))->toBe([]);
|
||||
})->with('action components');
|
||||
|
||||
@@ -7,9 +7,11 @@ use NoNameWeb\LivewireMaterial\Tests\Support\ViewClasses;
|
||||
/**
|
||||
* The containment components, rewritten without Tailwind (plan step 36): each view renders
|
||||
* `data-md-*` attributes and no class list of its own beyond the interaction and text classes
|
||||
* (tests/Support/ViewClasses.php), and each has a stylesheet in `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 "Containment" block of all.css.
|
||||
* (tests/Support/ViewClasses.php), writes its values from the tokens and its breakpoints as px
|
||||
* range queries, and is imported from the "Containment" block of all.css. Every component
|
||||
* stylesheet importing the stylesheets its view renders is tests/Feature/StylesheetsTest.php's
|
||||
* now, folded into one dataset over every component view (step 42) rather than kept once per
|
||||
* group.
|
||||
*
|
||||
* The dataset grew by one name per component commit, the same rule InputStylesheetsTest.php and
|
||||
* ActionStylesheetsTest.php follow. The error layout, whose view is not a component, has the same
|
||||
@@ -86,20 +88,6 @@ it('draws the component from a stylesheet shaped like every package stylesheet',
|
||||
}
|
||||
})->with('containment components');
|
||||
|
||||
it('imports the stylesheet of every component its view renders', function (string $name) {
|
||||
preg_match_all('/<x-livewire-material::([a-z-]+)/', File::get(__DIR__."/../../../resources/views/components/{$name}.blade.php"), $tags);
|
||||
|
||||
$rendered = collect($tags[1])->unique()
|
||||
// A rendered tag that is not a components/ stylesheet at all (a layout component's, e.g.
|
||||
// <x-pane>) has no import of its own to check here.
|
||||
->filter(fn (string $tag): bool => is_file(ComponentStylesheet::path($tag)) && str_contains(File::get(ComponentStylesheet::path($tag)), '@layer material.components'))
|
||||
->map(fn (string $tag): string => "./{$tag}.css")
|
||||
->values()
|
||||
->all();
|
||||
|
||||
expect(array_values(array_diff($rendered, ComponentStylesheet::read($name)->imports())))->toBe([]);
|
||||
})->with('containment components');
|
||||
|
||||
it('writes no class list into the view but the interaction and text classes', function (string $name) {
|
||||
expect(ViewClasses::violations(File::get(__DIR__."/../../../resources/views/components/{$name}.blade.php")))->toBe([]);
|
||||
})->with('containment components');
|
||||
|
||||
@@ -7,15 +7,16 @@ use NoNameWeb\LivewireMaterial\Tests\Support\ViewClasses;
|
||||
/**
|
||||
* The inputs, selection and data components, rewritten without Tailwind (plan step 36): each view
|
||||
* renders `data-md-*` attributes and no class list of its own beyond the interaction and text
|
||||
* classes (tests/Support/ViewClasses.php), and each has a stylesheet in
|
||||
* `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
|
||||
* "Inputs, selection and data" block of all.css.
|
||||
* classes (tests/Support/ViewClasses.php), writes its values from the tokens and its breakpoints
|
||||
* as px range queries, and is imported from the "Inputs, selection and data" block of all.css.
|
||||
* Every component stylesheet importing the stylesheets its view renders is
|
||||
* tests/Feature/StylesheetsTest.php's now, folded into one dataset over every component view (step
|
||||
* 42) rather than kept once per group.
|
||||
*
|
||||
* `pagination` is not in this dataset: its four views live in `resources/views/pagination/**`, not
|
||||
* `resources/views/components/`, so the two checks that read a single `resources/views/components/
|
||||
* {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.
|
||||
* `resources/views/components/`, so the check that reads a single `resources/views/components/
|
||||
* {name}.blade.php` file does not apply to it. It gets the two checks that do not depend on that
|
||||
* path below, and its own small version of the third.
|
||||
*/
|
||||
function inputComponents(): array
|
||||
{
|
||||
@@ -132,20 +133,6 @@ it('draws the component from a stylesheet shaped like every package stylesheet',
|
||||
}
|
||||
})->with('input stylesheets');
|
||||
|
||||
it('imports the stylesheet of every component its view renders', function (string $name) {
|
||||
preg_match_all('/<x-livewire-material::([a-z-]+)/', File::get(__DIR__."/../../../resources/views/components/{$name}.blade.php"), $tags);
|
||||
|
||||
$rendered = collect($tags[1])->unique()
|
||||
// A rendered tag that is not a components/ stylesheet at all (a layout component's, e.g.
|
||||
// <x-pane>) has no import of its own to check here.
|
||||
->filter(fn (string $tag): bool => is_file(ComponentStylesheet::path($tag)) && str_contains(File::get(ComponentStylesheet::path($tag)), '@layer material.components'))
|
||||
->map(fn (string $tag): string => "./{$tag}.css")
|
||||
->values()
|
||||
->all();
|
||||
|
||||
expect(array_values(array_diff($rendered, ComponentStylesheet::read($name)->imports())))->toBe([]);
|
||||
})->with('input components');
|
||||
|
||||
it('writes no class list into the view but the interaction and text classes', function (string $name) {
|
||||
expect(ViewClasses::violations(File::get(__DIR__."/../../../resources/views/components/{$name}.blade.php")))->toBe([]);
|
||||
})->with('input components');
|
||||
|
||||
@@ -7,15 +7,14 @@ use NoNameWeb\LivewireMaterial\Tests\Support\ViewClasses;
|
||||
/**
|
||||
* The navigation components, rewritten without Tailwind (plan step 36, the last audit group): each
|
||||
* view renders `data-md-*` attributes and no class list of its own beyond the interaction and text
|
||||
* classes (tests/Support/ViewClasses.php), and each has a stylesheet in `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 "Navigation" block of
|
||||
* all.css.
|
||||
* classes (tests/Support/ViewClasses.php), writes its values from the tokens and its breakpoints
|
||||
* as px range queries, and is imported from the "Navigation" block of all.css. Every component
|
||||
* stylesheet importing the stylesheets its view renders is tests/Feature/StylesheetsTest.php's
|
||||
* now, folded into one dataset over every component view (step 42, `tabs`/`tab`'s N-16 pairing
|
||||
* included) rather than kept once per group.
|
||||
*
|
||||
* The dataset grows by one name per component commit, the same rule ContainmentStylesheetsTest.php
|
||||
* and the earlier groups follow. `<x-tabs>` and `<x-tab>` share one stylesheet (tabs.css) and one
|
||||
* commit, so `navigationViews()` maps the 'tabs' entry onto both blade views; every other entry is
|
||||
* one view, one stylesheet, as usual. `navigation-bar` rejoined the dataset with the scaffold's own
|
||||
* and the earlier groups follow. `navigation-bar` rejoined the dataset with the scaffold's own
|
||||
* rewrite: its one rule reading `--material-bottom-bar` stayed unlayered only while `<x-scaffold>`
|
||||
* published that variable through a Tailwind utility, which no layered rule could outrank; now
|
||||
* scaffold.css sets it in `material.layout`, which this file's `material.components` always beats,
|
||||
@@ -120,24 +119,6 @@ it('draws the component from a stylesheet shaped like every package stylesheet',
|
||||
}
|
||||
})->with('navigation stylesheets');
|
||||
|
||||
it('imports the stylesheet of every component its view renders', function (string $name) {
|
||||
$rendered = collect(navigationViews($name))
|
||||
->flatMap(function (string $view): array {
|
||||
preg_match_all('/<x-livewire-material::([a-z-]+)/', File::get(__DIR__."/../../../resources/views/components/{$view}.blade.php"), $tags);
|
||||
|
||||
return $tags[1];
|
||||
})
|
||||
->unique()
|
||||
// A rendered tag that is not a components/ stylesheet at all (a layout component's, e.g.
|
||||
// <x-pane>) has no import of its own to check here.
|
||||
->filter(fn (string $tag): bool => is_file(ComponentStylesheet::path($tag)) && str_contains(File::get(ComponentStylesheet::path($tag)), '@layer material.components'))
|
||||
->map(fn (string $tag): string => "./{$tag}.css")
|
||||
->values()
|
||||
->all();
|
||||
|
||||
expect(array_values(array_diff($rendered, ComponentStylesheet::read($name)->imports())))->toBe([]);
|
||||
})->with('navigation components');
|
||||
|
||||
it('writes no class list into the view but the interaction and text classes', function (string $name) {
|
||||
foreach (navigationViews($name) as $view) {
|
||||
expect(ViewClasses::violations(File::get(__DIR__."/../../../resources/views/components/{$view}.blade.php")))->toBe([]);
|
||||
|
||||
Reference in New Issue
Block a user