import { beVisible, haveAttribute, html, notBeVisible, notHaveAttribute, test } from '../../../utils' test('button toggles panel', [html`
`], ({ get }) => { get('ul').should(notBeVisible()) get('button').click() get('ul').should(beVisible()) get('button').click() get('ul').should(notBeVisible()) }, ) test('popover can be rendered statically', [html`
`], ({ get }) => { get('ul').should(beVisible()) get('button').click() get('ul').should(beVisible()) }, ) test('has accessibility attributes', [html`
`], ({ get }) => { get('button').should(haveAttribute('aria-expanded', 'false')) get('button').should(notHaveAttribute('aria-controls')) get('button').click() get('button').should(haveAttribute('aria-expanded', 'true')) get('button').should(haveAttribute('aria-controls', 'alpine-popover-panel-1')) }, ) test('escape closes panel', [html`
`], ({ get }) => { get('ul').should(notBeVisible()) get('button').click() get('ul').should(beVisible()) get('body').type('{esc}') get('ul').should(notBeVisible()) }, ) test('clicking outside closes panel', [html`

Click away to me

`], ({ get }) => { get('ul').should(notBeVisible()) get('button').click() get('ul').should(beVisible()) get('h1').click() get('ul').should(notBeVisible()) }, ) test('focusing away closes panel', [html`
Focus Me
`], ({ get }) => { get('ul').should(notBeVisible()) get('button').click() get('ul').should(beVisible()) cy.focused().tab() get('ul').should(notBeVisible()) }, ) test('focusing away doesnt close panel if focusing inside a group', [html`
    Dialog 1 Contents!
    Dialog 2 Contents!
Focus Me
`], ({ get }) => { get('#1 ul').should(notBeVisible()) get('#2 ul').should(notBeVisible()) get('#1 button').click() get('#1 ul').should(beVisible()) get('#2 ul').should(notBeVisible()) cy.focused().tab() get('#1 ul').should(beVisible()) get('#2 ul').should(notBeVisible()) cy.focused().tab() get('#1 ul').should(notBeVisible()) get('#2 ul').should(notBeVisible()) }, ) test.retry(5)('focusing away still closes panel inside a group if the focus attribute is present', [html`
Focus Me
`], ({ get }) => { get('#1 ul').should(notBeVisible()) get('#2 ul').should(notBeVisible()) get('#1 button').click() get('#1 ul').should(beVisible()) get('#2 ul').should(notBeVisible()) cy.focused().tab() get('#1 ul').should(notBeVisible()) get('#2 ul').should(notBeVisible()) }, )