import { beVisible, haveAttribute, haveText, html, notBeVisible, notExist, test } from '../../../utils' test('has accessibility attributes', [html`
A description of the switch.
`], ({ get }) => { get('label').should(haveAttribute('id', 'alpine-switch-label-1')) get('[description"]').should(haveAttribute('id', 'alpine-switch-description-1')) get('button').should(haveAttribute('type', 'button')) get('button').should(haveAttribute('aria-labelledby', 'alpine-switch-label-1')) get('button').should(haveAttribute('aria-describedby', 'alpine-switch-description-1')) get('button').should(haveAttribute('role', 'switch')) get('button').should(haveAttribute('tabindex', 0)) get('button').should(haveAttribute('aria-checked', 'false')) get('button').click() get('button').should(haveAttribute('aria-checked', 'true')) }, ) test('works with x-model', [html`
Notifications are enabled.
`], ({ get }) => { get('article').should(notBeVisible()) get('button').click() get('article').should(beVisible()) get('button').click() get('article').should(notBeVisible()) }, ) test('works with internal state/$switch.isChecked', [html`
Notifications are enabled.
`], ({ get }) => { get('article').should(notBeVisible()) get('button').click() get('article').should(beVisible()) get('button').click() get('article').should(notBeVisible()) }, ) test('pressing space toggles the switch', [html`
Notifications are enabled.
`], ({ get }) => { get('article').should(notBeVisible()) get('button').focus() get('button').type(' ') get('article').should(beVisible()) get('button').type(' ') get('article').should(notBeVisible()) }, )