tests / feature (8.4) (push) Successful in 2m0s
tests / feature (8.5) (push) Successful in 2m0s
tests / browser (chrome, chromium) (push) Failing after 8m3s
tests / browser (firefox, firefox) (push) Failing after 12m58s
tests / browser (safari, webkit) (push) Failing after 13m8s
Tailwind left the stack in 2.0.0, but the package still carried about 330 mentions of it. What the guard's Tailwind detection protected — a class that compiles to nothing — is now protected by a check that does not care where a dead class came from. DesignGuard: about 500 lines of Tailwind tables, scales, palettes and "2.0.0 replacement" hints give way to one check — a class a view or PHP file writes that neither the application's stylesheets nor the package's own declare. It catches a utility of any framework, a typo and a class whose rules were deleted alike, so it also found two classes ReStride draws nothing with. A stylesheet has to be in reach for it: the `.css` files among the scanned paths, or what the `missingStylesheets()` entry imports. The class reader no longer mistakes an array index for a class list (`$block['base']`), and it reads the array a class helper is given, where it read nothing before. The package's own three Tailwind self-guards go with it. Only their one unique check stays, as a test of its own: every `matchMedia` width in resources/js is an M3 breakpoint. The pagination views are `material.blade.php` and `simple-material.blade.php`; only Laravel's and Livewire's default theme names ever made them `tailwind`. The provider sets `Paginator`'s default views and switches `livewire.pagination_theme` to `material` when it is still Livewire's own default, so no application can forget the config; a theme an application chose, and a component's own `$paginationTheme` or `paginationView()`, still win. The rest is prose: the layer-order guidance for an application that still builds Tailwind, the Tailwind wording in the README, the Boost guidelines and the development skill, and about 25 "this used to be a Tailwind utility" comments, along with every "plan step NN" pointer into a gitignored folder. The reset keeps its credit, and NOTICE now carries it too. Feature suite 1159 passed, Chrome browser suite 299 passed. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
47 lines
3.2 KiB
PHP
47 lines
3.2 KiB
PHP
<?php
|
|
|
|
/**
|
|
* A caller's `class` and `style` land on a component's root, untouched and once: an application's
|
|
* width or margin sizes the whole component, whichever element its other attributes reach. The
|
|
* field family, the pickers and the components that split their attributes between a root and an
|
|
* inner control are the ones that can get it wrong, so each is rendered here with both.
|
|
*/
|
|
it('lands a caller\'s class and style on the root, and only there', function (string $blade) {
|
|
$html = (string) $this->blade($blade);
|
|
|
|
preg_match('/<([a-z]+)((?:[^>"\']|"[^"]*"|\'[^\']*\')*)>/', ltrim($html), $root);
|
|
|
|
expect($root[2] ?? '')
|
|
->toContain('class="caller-class')
|
|
->toContain('--caller-width: 192px')
|
|
->and(substr_count($html, 'caller-class'))->toBe(1, 'the class lands more than once')
|
|
->and(substr_count($html, '--caller-width'))->toBe(1, 'the style lands more than once');
|
|
})->with([
|
|
'input' => '<x-input label="Name" class="caller-class" style="--caller-width: 192px" />',
|
|
'password' => '<x-password label="Password" class="caller-class" style="--caller-width: 192px" />',
|
|
'textarea' => '<x-textarea label="Message" class="caller-class" style="--caller-width: 192px" />',
|
|
'textarea, fixed height' => '<x-textarea label="Message" :autogrow="false" class="caller-class" style="--caller-width: 192px" />',
|
|
'select' => '<x-select label="Expiry" :options="[]" class="caller-class" style="--caller-width: 192px" />',
|
|
'file' => '<x-file label="Attachments" class="caller-class" style="--caller-width: 192px" />',
|
|
'datepicker' => '<x-datepicker label="From" class="caller-class" style="--caller-width: 192px" />',
|
|
'timepicker' => '<x-timepicker label="At" class="caller-class" style="--caller-width: 192px" />',
|
|
'choices' => '<x-choices label="Days" :options="[]" class="caller-class" style="--caller-width: 192px" />',
|
|
'search' => '<x-search placeholder="Search" class="caller-class" style="--caller-width: 192px" />',
|
|
'group' => '<x-group label="Theme" name="theme" :options="[[\'id\' => 1, \'name\' => \'One\']]" class="caller-class" style="--caller-width: 192px" />',
|
|
'split button' => '<x-split-button label="Save" class="caller-class" style="--caller-width: 192px" />',
|
|
'checkbox' => '<x-checkbox label="Tick" class="caller-class" style="--caller-width: 192px" />',
|
|
'radio' => '<x-radio label="Pick" name="pick" :options="[[\'id\' => 1, \'name\' => \'One\']]" class="caller-class" style="--caller-width: 192px" />',
|
|
'toggle' => '<x-toggle label="On" class="caller-class" style="--caller-width: 192px" />',
|
|
'slider' => '<x-slider label="Volume" class="caller-class" style="--caller-width: 192px" />',
|
|
]);
|
|
|
|
it('keeps a textarea\'s own row count beside a caller\'s style', function () {
|
|
$html = (string) $this->blade('<x-textarea label="Message" rows="2" max-rows="6" style="max-width: 320px" />');
|
|
|
|
// A second style attribute on the <textarea> would be ignored by the browser, rows and all.
|
|
preg_match('/<textarea\b(?:[^>"]|"[^"]*")*>/', $html, $control);
|
|
|
|
expect(substr_count($control[0] ?? '', 'style="'))->toBe(1)
|
|
->and($control[0] ?? '')->toMatch('/style="--field-rows: 2;\s*--field-max-rows: 6;"/');
|
|
});
|