diff --git a/tests/Browser/BarsTest.php b/tests/Browser/BarsTest.php index 1a08f147..045059cb 100644 --- a/tests/Browser/BarsTest.php +++ b/tests/Browser/BarsTest.php @@ -317,9 +317,10 @@ function toolbarScaffoldProbe() ['title' => 'Sent', 'icon' => 'send', 'url' => '/toolbar-scaffold-probe'], ]"> - + - + +
@@ -357,6 +358,21 @@ it('rounds a docked toolbar and its divider from 840px, clear of the window\'s e ->assertNoJavaScriptErrors(); }); +it('draws a disabled icon button inside a toolbar disabled, not in the toolbar\'s primary recolour', function () { + // toolbar.css recolours a standard (non-vibrant) toolbar's icon buttons to primary, but its + // selector excludes :disabled and [aria-disabled] so button.css's own disabled colour still + // wins there (resources/css/components/toolbar.css). A scratch element resolves each formula + // to a real rgb string, so the comparison does not have to guess the browser's serialization. + $primary = "(() => { const d = document.createElement('span'); d.style.color = 'var(--md-sys-color-primary)'; document.body.appendChild(d); const v = getComputedStyle(d).color; d.remove(); return v; })()"; + $disabledColor = "(() => { const d = document.createElement('span'); d.style.color = 'color-mix(in srgb, var(--md-sys-color-on-surface) calc(var(--md-sys-state-disabled-content-opacity) * 100%), transparent)'; document.body.appendChild(d); const v = getComputedStyle(d).color; d.remove(); return v; })()"; + + toolbarScaffoldProbe()->resize(1024, 800) + ->assertScript("getComputedStyle(document.querySelector('#bold-btn')).color === {$primary}") + ->assertScript("getComputedStyle(document.querySelector('#underline-btn')).color !== {$primary}") + ->assertScript("getComputedStyle(document.querySelector('#underline-btn')).color === {$disabledColor}") + ->assertNoJavaScriptErrors(); +}); + function tabsFirstPaintProbe(): void { Route::middleware('web')->get('/tabs-first-paint-probe', fn () => Blade::render(<<<'BLADE'