Run the design guard's smoke test with missingStylesheets(), as Blade resolves

Plan step 41 review: the committed smoke test scanned the package's views
without the stylesheet check, so the claim that the package, showcase and
Workbench pass it through all.css was untested; it now runs it, and
checks the showcase's plain tags do need imports from a foundation-only
entry, so the pass is not vacuous. Doing so exposed that a component class
one test evals leaked into every later check in the process: the shadow
check now guesses the class the way Blade does (Blade::component()
aliases, component namespaces, the application's own root namespace), and
the test gives its class a namespace of its own.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Qwx5USif3wFFmxtHg5U1g9
This commit is contained in:
Andreas Reinhold / reini
2026-09-15 08:50:13 +02:00
co-authored by Claude Opus 5
parent 2073480da4
commit 2d75091b82
2 changed files with 36 additions and 11 deletions
+24 -6
View File
@@ -3,9 +3,11 @@
namespace NoNameWeb\LivewireMaterial\Testing;
use Illuminate\Support\Str;
use Illuminate\View\Compilers\ComponentTagCompiler;
use NoNameWeb\LivewireMaterial\Support\Layout;
use NoNameWeb\LivewireMaterial\Support\Stylesheets;
use NoNameWeb\LivewireMaterial\Support\SvgFile;
use RuntimeException;
use SplFileInfo;
use Symfony\Component\Finder\Finder;
@@ -1227,15 +1229,31 @@ class DesignGuard
}
/**
* Whether the application defines its own component of this name — an anonymous
* `resources/views/components/<name>.blade.php`, found the way Blade itself falls back to it
* (the base view finder's `components.<name>`, which `resource_path('views/components')`
* feeds by default), or an `App\View\Components` class. Either wins over this package's
* `<x-{$name}>` in Blade's own resolution order.
* Whether the application defines its own component of this name, found the way Blade itself
* looks before it reaches this package's anonymous path: an alias registered with
* `Blade::component()`, a class under the application's `View\\Components` namespace (its own
* root namespace, as Blade guesses it), or an anonymous
* `resources/views/components/<name>.blade.php` (the base view finder's `components.<name>`).
*/
protected function shadowedByApplication(string $name): bool
{
return view()->exists('components.'.$name) || class_exists('App\\View\\Components\\'.Str::studly($name));
if (view()->exists('components.'.$name)) {
return true;
}
$blade = app('blade.compiler');
$compiler = new ComponentTagCompiler($blade->getClassComponentAliases(), $blade->getClassComponentNamespaces(), $blade);
try {
$class = $compiler->guessClassName($name);
} catch (RuntimeException) {
return false; // No application namespace to guess a class in.
}
return isset($blade->getClassComponentAliases()[$name])
|| $compiler->findClassByComponent($name) !== null
|| class_exists($class)
|| class_exists($class.'\\'.Str::afterLast($class, '\\'));
}
/**