import { haveClasses, beVisible, haveAttribute, haveText, html, notBeVisible, notExist, test, haveFocus, notHaveClasses, notHaveAttribute } from '../../../utils' test('it works', [html`

Signed in as

tom@example.com

Account settings Support New feature (soon) License
Sign out
`], ({ get }) => { get('[items]').should(notBeVisible()) get('[trigger]').click() get('[items]').should(beVisible()) }, ) test('focusing away closes menu', [html`

Signed in as

tom@example.com

Account settings Support License
Sign out
`], ({ get }) => { get('[items]').should(notBeVisible()) get('[trigger]').click() get('[items]').should(beVisible()) cy.focused().tab() get('[items]').should(notBeVisible()) }, ) test('it works with x-model', [html`

Signed in as

tom@example.com

Account settings Support New feature (soon) License
Sign out
`], ({ get }) => { get('[items]').should(notBeVisible()) get('[trigger]').click() get('[items]').should(beVisible()) get('[trigger]').click() get('[items]').should(notBeVisible()) }, ) test('keyboard controls', [html`

Signed in as

tom@example.com

Account settings Support New feature (soon) License
Sign out
`], ({ get }) => { get('.active').should(notExist()) get('[trigger]').type(' ') get('[items]') .should(beVisible()) .should(haveFocus()) .type('{downarrow}') get('[href="#account-settings"]') .should(haveClasses(['active'])) get('[items]') .type('{downarrow}') get('[href="#support"]') .should(haveClasses(['active'])) .type('{downarrow}') get('[href="#license"]') .should(haveClasses(['active'])) get('[items]') .type('{uparrow}') get('[href="#support"]') .should(haveClasses(['active'])) get('[items]') .type('{home}') get('[href="#account-settings"]') .should(haveClasses(['active'])) get('[items]') .type('{end}') get('[href="#sign-out"]') .should(haveClasses(['active'])) get('[items]') .type('{pageUp}') get('[href="#account-settings"]') .should(haveClasses(['active'])) get('[items]') .type('{pageDown}') get('[href="#sign-out"]') .should(haveClasses(['active'])) get('[items]') .tab() .should(haveFocus()) .should(beVisible()) .tab({ shift: true}) .should(haveFocus()) .should(beVisible()) .type('{esc}') .should(notBeVisible()) }, ) test('keyboard controls with x-teleport', [html`
`], ({ get }) => { get('.active').should(notExist()) get('[trigger]').type(' ') get('[items]') .should(beVisible()) .should(haveFocus()) .type('{downarrow}') get('[href="#account-settings"]') .should(haveClasses(['active'])) get('[items]') .type('{downarrow}') get('[href="#support"]') .should(haveClasses(['active'])) .type('{uparrow}') get('[href="#account-settings"]') .should(haveClasses(['active'])) get('[items]') .tab() .should(haveFocus()) .should(beVisible()) .tab({ shift: true}) .should(haveFocus()) .should(beVisible()) .type('{esc}') .should(notBeVisible()) }, ) test('search', [html`

Signed in as

tom@example.com

Account settings Support New feature (soon) License
Sign out
`], ({ get, wait }) => { get('.active').should(notExist()) get('[trigger]').click() get('[items]') .type('ac') get('[href="#account-settings"]') .should(haveClasses(['active'])) wait(500) get('[items]') .type('si') get('[href="#sign-out"]') .should(haveClasses(['active'])) }, ) test('has accessibility attributes', [html`

Signed in as

tom@example.com

Account settings Support New feature (soon) License
Sign out
`], ({ get }) => { get('[trigger]') .should(haveAttribute('aria-haspopup', 'true')) .should(haveAttribute('aria-labelledby', 'alpine-menu-label-1')) .should(haveAttribute('aria-expanded', 'false')) .should(notHaveAttribute('aria-controls')) .should(haveAttribute('id', 'alpine-menu-button-1')) .click() .should(haveAttribute('aria-expanded', 'true')) .should(haveAttribute('aria-controls', 'alpine-menu-items-1')) get('[items]') .should(haveAttribute('aria-orientation', 'vertical')) .should(haveAttribute('role', 'menu')) .should(haveAttribute('id', 'alpine-menu-items-1')) .should(haveAttribute('aria-labelledby', 'alpine-menu-button-1')) .should(notHaveAttribute('aria-activedescendant')) .should(haveAttribute('tabindex', '0')) .type('{downarrow}') .should(haveAttribute('aria-activedescendant', 'alpine-menu-item-1')) get('[href="#account-settings"]') .should(haveAttribute('role', 'menuitem')) .should(haveAttribute('id', 'alpine-menu-item-1')) .should(haveAttribute('tabindex', '-1')) get('[href="#support"]') .should(haveAttribute('role', 'menuitem')) .should(haveAttribute('id', 'alpine-menu-item-2')) .should(haveAttribute('tabindex', '-1')) get('[items]') .type('{downarrow}') .should(haveAttribute('aria-activedescendant', 'alpine-menu-item-2')) }, ) test('$menuItem.isDisabled', [html`

Signed in as

tom@example.com

Account settings Support New feature (soon) License
Sign out
`], ({ get }) => { get('[trigger]').click() get('[href="#account-settings"]').should(notHaveClasses(['disabled'])) get('[href="#support"]').should(notHaveClasses(['disabled'])) get('[href="#new-feature"]').should(haveClasses(['disabled'])) }, )