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

49 lines
2.0 KiB
PHP

<?php
use Livewire\Component;
use Livewire\Livewire;
/** The child component in each row of `KeyedRowsProbe`. */
class KeyedRowChildProbe extends Component
{
public function render(): string
{
return '<p data-row-child>Row</p>';
}
}
/**
* A list whose rows each hold `$markup`, then a child component. Livewire keys a child from the
* loop around it, and takes a `wire:key` written in any template rendered in the row for the row's
* key: a component that wrote its own that way would key every row's child alike.
*/
class KeyedRowsProbe extends Component
{
public static string $markup = '';
public function render(): string
{
return '<div>@foreach ([1, 2] as $row)<div wire:key="row-{{ $row }}">'.static::$markup.'<livewire:keyed-row-child-probe /></div>@endforeach</div>';
}
}
it('keys what a morph must patch in place, without keying the child components after it', function (string $markup, string $key) {
Livewire::component('keyed-row-child-probe', KeyedRowChildProbe::class);
Livewire::component('keyed-rows-probe', KeyedRowsProbe::class);
KeyedRowsProbe::$markup = $markup;
$html = Livewire::test('keyed-rows-probe')->html();
preg_match_all('/<p\b[^>]*\bwire:key="([^"]+)"[^>]*>Row<\/p>/', $html, $children);
expect(substr_count($html, "wire:key=\"{$key}\""))->toBe(2)
->and($children[1])->toHaveCount(2)
->and(array_unique($children[1]))->toHaveCount(2);
})->with([
'menu' => ['<x-menu label="Row actions"><x-slot:trigger><button>More</button></x-slot:trigger><x-menu-item label="Delete" /></x-menu>', 'material-menu'],
'FAB menu' => ['<x-fab-menu label="New"><x-fab-menu-item label="Upload" /></x-fab-menu>', 'material-fab-menu'],
'rich tooltip' => ['<x-rich-tooltip text="Details"><button>i</button></x-rich-tooltip>', 'material-rich-tooltip'],
'carousel' => ['<x-carousel label="Photos"><x-carousel-item><div class="app-carousel-slide"></div></x-carousel-item></x-carousel>', 'material-carousel'],
]);