Write the showcase examples' layout tags as an application does
Plan step 38 review: nine sections' examples wrapped their components in <x-livewire-material::stack>, ::row and ::grid (148 tags) beside an unprefixed <x-button>, while bars, containment and the layout pages wrote <x-stack>. The code sample is what an application copies, and the example component rewrites only unprefixed tags to a configured prefix, so the namespaced ones taught a second form and escaped it. Every example now writes <x-stack>, <x-row> and <x-grid>; a test rejects a namespaced tag inside an example heredoc. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qwx5USif3wFFmxtHg5U1g9
This commit is contained in:
co-authored by
Claude Opus 5
parent
5fb8fc6b8f
commit
3fb0a404db
@@ -117,6 +117,25 @@ it('indexes exactly the examples each page renders, so an example the index miss
|
||||
}
|
||||
});
|
||||
|
||||
it('writes every example as an application writes it', function () {
|
||||
$files = collect(File::glob(__DIR__.'/../../resources/views/showcase/sections/*.blade.php'))
|
||||
->merge(File::glob(__DIR__.'/../../resources/views/showcase/layout/*.blade.php'));
|
||||
|
||||
$examples = $files->flatMap(function (string $file): array {
|
||||
preg_match_all("/<<<'BLADE'\n(.*?)^\s*BLADE[,;]/sm", File::get($file), $matches);
|
||||
|
||||
return array_map(fn (string $code): array => [basename($file), $code], $matches[1]);
|
||||
});
|
||||
|
||||
expect($examples)->not->toBeEmpty();
|
||||
|
||||
foreach ($examples as [$file, $code]) {
|
||||
// The example component rewrites unprefixed tags to a configured prefix; a namespaced tag
|
||||
// would show an application a form it does not write, and escape that rewrite.
|
||||
expect($code)->not->toContain('x-livewire-material::', "{$file} writes a namespaced tag in an example");
|
||||
}
|
||||
});
|
||||
|
||||
it('does not mount the showcase when disabled', function () {
|
||||
rebootWithShowcase(false);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user