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,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