Cover six actions/communication behaviours the browser suite missed
Plan step 36's handoff listed six behaviours no browser test exercised yet: - FieldsTest: <x-select>'s open list uses the customizable picker (appearance: base-select) where the browser supports it, drawn as M3's 48px-row menu. - CommunicationTest: a two-line snackbar's action stays on the title's row from 600px, only wrapping under it below that (toast.css's [data-md-toast-wrap]). - ActionsTest: a disabled menu item reached by the keyboard withholds its state layer (interaction.css's [aria-disabled="true"] rule). - DataTest: a paginator's page step shows md-focus-ring's outline on keyboard focus, alongside its already-tested 48px target. - CommunicationTest: a transient rich tooltip stays open 1.5s after focus leaves rather than closing at once (rich-tooltip.js's LEAVE_GRACE_MS). - ActionsTest: an xs or sm group segment takes a press at its 48px edge, past its drawn size, now that the target comes from the shared md-touch-target class rather than a rule of its own. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qwx5USif3wFFmxtHg5U1g9
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
4bf1ca13a3
commit
a29a147f1a
@@ -197,6 +197,26 @@ it('grows to M3\'s two-line height with a description, and Alt+G reaches its act
|
||||
->assertScript('document.activeElement === '.TOAST."?.querySelector('[data-md-toast-action]')");
|
||||
});
|
||||
|
||||
it('keeps a two-line snackbar\'s action on the title\'s row from 600px, wrapping under it only below that', function () {
|
||||
$page = visit('/material/communication')->resize(400, 800)->waitForEvent('networkidle')
|
||||
->assertScript("document.readyState === 'complete' && typeof window.Alpine !== 'undefined' && typeof window.Livewire !== 'undefined'");
|
||||
|
||||
$page->script("materialToast('Upload paused', { description: 'The connection dropped at 64%.', action: { label: 'Retry now', handler: () => {} } })");
|
||||
|
||||
$title = TOAST."?.querySelector('[data-md-toast-title]')";
|
||||
$action = TOAST."?.querySelector('[data-md-toast-action]')";
|
||||
|
||||
// Below 600px M3's "two lines with longer action" wraps the action under both lines of text
|
||||
// (toast.css's [data-md-toast-wrap]), so it starts only once the title's line has ended.
|
||||
$page->assertScript("{$title}.textContent.includes('Upload paused')")
|
||||
->assertScript("{$action}.getBoundingClientRect().top >= {$title}.getBoundingClientRect().bottom");
|
||||
|
||||
// From 600px it stays beside the title's line instead: the two boxes overlap vertically.
|
||||
$page->resize(600, 800)
|
||||
->assertScript("{$action}.getBoundingClientRect().top < {$title}.getBoundingClientRect().bottom")
|
||||
->assertScript("{$action}.getBoundingClientRect().bottom > {$title}.getBoundingClientRect().top");
|
||||
});
|
||||
|
||||
it('opens a persistent rich tooltip on press', function () {
|
||||
$bubble = "document.querySelector('#communication [role=\"dialog\"][popover]')";
|
||||
|
||||
@@ -206,6 +226,31 @@ it('opens a persistent rich tooltip on press', function () {
|
||||
->assertScript("{$bubble}.matches(':popover-open')");
|
||||
});
|
||||
|
||||
it('closes a transient rich tooltip 1.5s after focus leaves, not at once', function () {
|
||||
$trigger = '#communication button[aria-label="About expiry"]';
|
||||
$bubble = "document.querySelector('#communication [role=\"tooltip\"][popover]')";
|
||||
|
||||
$page = visit('/material/communication')->waitForEvent('networkidle')
|
||||
->assertScript("document.readyState === 'complete' && typeof window.Alpine !== 'undefined' && typeof window.Livewire !== 'undefined'");
|
||||
|
||||
// A key press first, so the browser is in keyboard modality, as a keyboard user would be.
|
||||
$page->keys('#communication', 'Tab');
|
||||
$page->script("document.querySelector('{$trigger}').focus()");
|
||||
|
||||
$page->assertScript("document.activeElement === document.querySelector('{$trigger}')")
|
||||
->assertScript("{$bubble}.matches(':popover-open')");
|
||||
|
||||
$page->script("document.querySelector('{$trigger}').blur()");
|
||||
|
||||
// Still open shortly after focus leaves: it stands for 1.5s (rich-tooltip.js's
|
||||
// LEAVE_GRACE_MS), not closing the instant focus does.
|
||||
$page->wait(0.3)
|
||||
->assertScript("{$bubble}.matches(':popover-open')");
|
||||
|
||||
$page->wait(1.4)
|
||||
->assertScript("! {$bubble}.matches(':popover-open')");
|
||||
});
|
||||
|
||||
it('keeps a rich tooltip open while its action renders the component, and opens it again after', function () {
|
||||
Livewire::component('rich-tooltip-morph-probe', RichTooltipMorphProbe::class);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user