Give every component view a stylesheet, or a documented exception
Audits step 42's "every component view has a stylesheet" against the whole of resources/views/components/: everything already has one, apart from two that need none, now documented in the test itself — theme-script renders an inline <script> only, and tab is drawn by tabs.css, its parent <x-tabs>'s own stylesheet. 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
6897306e18
commit
6efb0b5a30
@@ -445,6 +445,31 @@ it('imports every stylesheet under components/ and layout/ directly, each exactl
|
||||
expect($actual)->toBe($expected);
|
||||
});
|
||||
|
||||
it('gives every component view a stylesheet, or lists it on a short, documented exception', function () {
|
||||
// theme-script renders an inline <script> only — no markup of its own for a stylesheet to
|
||||
// draw. tab renders data-md-tab-panel, drawn by tabs.css, its parent <x-tabs>'s own
|
||||
// stylesheet (tabs.blade.php's own header says so).
|
||||
$exceptions = ['theme-script' => true, 'tab' => true];
|
||||
|
||||
$views = collect(File::files(__DIR__.'/../../resources/views/components'))
|
||||
->map(fn (SplFileInfo $file): string => $file->getBasename('.blade.php'));
|
||||
|
||||
expect($views)->not->toBeEmpty();
|
||||
|
||||
foreach ($views as $name) {
|
||||
if (isset($exceptions[$name])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
expect(is_file(stylesheetPath("components/{$name}.css")) || is_file(stylesheetPath("layout/{$name}.css")))
|
||||
->toBeTrue("{$name}.blade.php has no stylesheet, in components/ or layout/, and is not on the documented exception list");
|
||||
}
|
||||
|
||||
foreach (array_keys($exceptions) as $name) {
|
||||
expect($views->contains($name))->toBeTrue("{$name} is on the documented exception list but no longer exists as a component view");
|
||||
}
|
||||
});
|
||||
|
||||
it('imports a stylesheet for every layout component from all.css, each beside its view', function () {
|
||||
$imports = array_values(array_filter(
|
||||
stylesheetImports(stylesheetPath('all.css')),
|
||||
|
||||
Reference in New Issue
Block a user