Files
Andreas Reinhold / reiniandClaude Sonnet 5 6897306e18 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
2026-09-15 09:32:36 +02:00

44 lines
2.1 KiB
PHP

<?php
use Illuminate\View\ViewException;
use NoNameWeb\LivewireMaterial\Support\SvgFile;
it('ships M3 Expressive\'s 35 shapes', function () {
expect(SvgFile::shapeNames())->toHaveCount(35)
->toContain('circle', 'cookie-9', 'clover-4', 'soft-burst', 'pixel-triangle', 'heart');
});
it('draws every shape as one path in the text colour, filling a 100-unit box', function () {
foreach (SvgFile::shapeNames() as $shape) {
$svg = file_get_contents(__DIR__."/../../../resources/svg/shapes/{$shape}.svg");
expect($svg)->toMatch('#^<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" fill="currentColor"><path d="[MCZ0-9. -]+"/></svg>\n$#');
preg_match_all('/-?\d+(?:\.\d+)?/', str($svg)->after(' d="')->before('"')->toString(), $numbers);
$xs = array_map('floatval', array_filter($numbers[0], fn ($key) => $key % 2 === 0, ARRAY_FILTER_USE_KEY));
$ys = array_map('floatval', array_filter($numbers[0], fn ($key) => $key % 2 === 1, ARRAY_FILTER_USE_KEY));
expect(min([...$xs, ...$ys]))->toBeGreaterThanOrEqual(0)
->and(max([...$xs, ...$ys]))->toBeLessThanOrEqual(100)
->and(max(max($xs) - min($xs), max($ys) - min($ys)))->toBeGreaterThanOrEqual(96, "{$shape} does not fill its box");
}
});
it('renders a shape hidden from assistive tech', function () {
$this->blade('<x-shape name="cookie-9" class="app-badge-shape" />')
->assertSee('<svg data-md-shape="data-md-shape" aria-hidden="true" focusable="false" class="app-badge-shape" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"', false);
});
it('draws the size it is given', function () {
$this->blade('<x-shape name="cookie-9" size="160" />')
->assertSee('style="--md-shape-size: 160px"', false);
$this->blade('<x-shape name="cookie-9" size="huge" />')
->assertDontSee('--md-shape-size', false);
});
it('refuses a shape that does not exist', function () {
expect(fn () => $this->blade('<x-shape name="blob" />'))
->toThrow(ViewException::class, 'There is no M3 Expressive shape named [blob].');
});