Prove no Tailwind utility class remains in resources/ or tests/

StylesheetsTest.php's new test runs DesignGuard's own family table (check
(i)) over resources/views, resources/js, src, tests/Browser and
tests/Feature — the guard turned on the package's own source, so the two
never drift apart. tests/Feature/DesignGuardTest.php and
tests/Fixtures/design-guard/ carry Tailwind on purpose and are left out.

The scan found Tailwind-shaped class strings used as caller classes in 21
test files (a component test proving a caller's class lands on the root or
a caller's size wins, mostly), left over from before Tailwind cleared the
whole stack: replaced with neutral application-style names (`app-hero-icon`)
or, where one already carries the right meaning, an `md-*` class
(`md-text-end`, `md-ink-warning`). BreakpointsTest.php's own heredoc probe —
which needs a genuine Tailwind-shaped breakpoint prefix to prove its
detection works — now builds that one string from a placeholder at runtime,
so its own source stays clean for this same scan.

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:
Andreas Reinhold / reini
2026-09-15 09:32:36 +02:00
co-authored by Claude Sonnet 5
parent 3d9e494e22
commit 6897306e18
22 changed files with 95 additions and 65 deletions
+23
View File
@@ -1,7 +1,9 @@
<?php
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\File;
use NoNameWeb\LivewireMaterial\Support\Layout;
use NoNameWeb\LivewireMaterial\Testing\DesignGuard;
/**
* The package's stylesheets are plain CSS in `material.*` layers, with no Tailwind in them. Every
@@ -313,6 +315,27 @@ it('writes no Tailwind directive anywhere all.css reaches', function () {
}
});
it('writes no Tailwind utility class anywhere under resources/ or tests/', function () {
// DesignGuard's own family table (check (i)) is the standing definition of a Tailwind
// utility or variant — this test is that guard turned on the package's own source, so the
// two never drift apart. tests/Feature/DesignGuardTest.php and tests/Fixtures/design-guard/
// carry Tailwind on purpose (they are the guard's own fixtures) and are left out.
$root = __DIR__.'/../..';
$designGuardTest = (string) realpath($root.'/tests/Feature/DesignGuardTest.php');
$paths = collect(['resources/views', 'resources/js', 'src', 'tests/Browser', 'tests/Feature'])
->flatMap(fn (string $directory): Collection => collect(File::allFiles($root.'/'.$directory)))
->filter(fn (SplFileInfo $file): bool => in_array($file->getExtension(), ['php', 'js', 'ts'], true))
->reject(fn (SplFileInfo $file): bool => (string) $file->getRealPath() === $designGuardTest)
->map(fn (SplFileInfo $file): string => (string) $file->getRealPath())
->values()
->all();
expect($paths)->not->toBeEmpty();
expect(DesignGuard::scan($paths)->violations())->toBe([]);
});
it('writes a media query, anywhere all.css reaches, only at M3\'s breakpoints, in px', function () {
$queries = collect(allStylesheets())
->flatMap(function (string $file): array {