Hide a standard side sheet's scrim from 840px again
Plan step 36 review of 9dd527f3. The old view hid a standard sheet's
scrim with `expanded:hidden`; the stylesheet lost that rule (and the
render test lost its assertion), so an open standard sheet at 840px and
up laid a full-window scrim over the page it sits beside, one click from
closing. The rule is back, pinned by a test.
The same review: the scrim now fades out as well as in (with no closed
opacity, allow-discrete only held it at 32% for 200ms and then dropped
it); the modal sheet slides without the fade the old enter and leave
classes never had; it slides from its own edge in a right-to-left
document, which translate-x-full never did; the state rules match the
root's own sheet and scrim, so a sheet nested in an open one keeps its
state; the script's breakpoint is 840px, not 52.5rem, which disagreed
with the stylesheet's px query once the reader's text size grew; and
`width` and the standard sheet's cap are M3's 400px.
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
d86392fd47
commit
b6259d45f3
@@ -3,6 +3,7 @@
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Livewire\Component;
|
||||
use Livewire\Livewire;
|
||||
use NoNameWeb\LivewireMaterial\Tests\Support\ComponentStylesheet;
|
||||
|
||||
it('opens a native dialog entangled with a Livewire property, out of the morph\'s reach', function () {
|
||||
$component = new class extends Component
|
||||
@@ -226,22 +227,40 @@ it('is M3\'s standard side sheet from expanded, and the modal one below', functi
|
||||
|
||||
expect($html)
|
||||
->toContain('data-md-standard')
|
||||
->toContain('--sheet-width: min(25rem, 25rem)')
|
||||
->toContain("matchMedia('(width >= 52.5rem)')")
|
||||
->toContain('--sheet-width: min(400px, 400px)')
|
||||
->toContain("matchMedia('(width >= 840px)')")
|
||||
->toContain('x-trap.inert.noscroll="open && ! wide"')
|
||||
->toContain('aria-label="Close"')
|
||||
->and((string) $this->blade('<x-drawer standard side="start" width="30rem">Body</x-drawer>'))
|
||||
->toContain('data-md-side="start"')
|
||||
->toContain('--sheet-width: min(30rem, 25rem)')
|
||||
->toContain('--sheet-width: min(30rem, 400px)')
|
||||
->and((string) $this->blade('<x-drawer title="Filters">Body</x-drawer>'))
|
||||
->not->toContain('data-md-standard');
|
||||
|
||||
expect(File::get(__DIR__.'/../../../resources/css/components/drawer.css'))
|
||||
->toContain('[data-md-drawer][data-md-standard]')
|
||||
->toContain('[data-md-drawer][data-md-standard][data-md-drawer-collapsed]')
|
||||
->toContain('[data-md-drawer][data-md-standard] [data-md-drawer-sheet][data-md-side=\'end\']')
|
||||
->toContain('[data-md-drawer][data-md-standard] [data-md-drawer-sheet][data-md-side=\'start\']')
|
||||
->toContain('box-shadow: none;');
|
||||
$css = ComponentStylesheet::read('drawer');
|
||||
$expanded = ['@media (width >= 840px)'];
|
||||
|
||||
expect($css->has('[data-md-drawer][data-md-standard]', $expanded))->toBeTrue()
|
||||
->and($css->declarations('[data-md-drawer][data-md-standard][data-md-drawer-collapsed]', $expanded))->toBe(['display' => 'none'])
|
||||
// The old view's `expanded:hidden` on a standard sheet's scrim.
|
||||
->and($css->declarations('[data-md-drawer][data-md-standard] > [data-md-drawer-scrim]', $expanded))->toBe(['display' => 'none'])
|
||||
->and($css->declarations('[data-md-drawer][data-md-standard] > [data-md-drawer-sheet]', $expanded))->toHaveKey('box-shadow', 'none')
|
||||
->and($css->has("[data-md-drawer][data-md-standard] > [data-md-drawer-sheet][data-md-side='end']", $expanded))->toBeTrue()
|
||||
->and($css->has("[data-md-drawer][data-md-standard] > [data-md-drawer-sheet][data-md-side='start']", $expanded))->toBeTrue();
|
||||
});
|
||||
|
||||
it('slides a side sheet out as it slid in, from its own edge in either direction, and fades its scrim both ways', function () {
|
||||
$css = ComponentStylesheet::read('drawer');
|
||||
|
||||
expect($css->declarations('[data-md-drawer-sheet]'))
|
||||
->toHaveKey('translate', 'var(--sheet-offset) 0')
|
||||
->toHaveKey('transition-behavior', 'allow-discrete')
|
||||
->not->toHaveKey('opacity')
|
||||
->and($css->declarations("[data-md-drawer-sheet][data-md-side='end']:dir(rtl)"))->toBe(['--sheet-offset' => '-100%'])
|
||||
->and($css->declarations("[data-md-drawer-sheet][data-md-side='start']:dir(rtl)"))->toBe(['--sheet-offset' => '100%'])
|
||||
->and($css->declarations('[data-md-drawer][data-md-open] > [data-md-drawer-sheet]', ['@starting-style']))->toBe(['translate' => 'var(--sheet-offset) 0'])
|
||||
->and($css->declarations('[data-md-drawer-scrim]'))->toHaveKey('opacity', '0')
|
||||
->and($css->declarations('[data-md-drawer][data-md-open] > [data-md-drawer-scrim]'))->toBe(['opacity' => '1']);
|
||||
});
|
||||
|
||||
it('draws the drawer from a stylesheet imported from the containment block, with the pane prop gone', function () {
|
||||
|
||||
Reference in New Issue
Block a user