Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add failing test for keyboard controls with x-teleport #4031

Merged
merged 1 commit into from
Feb 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions tests/cypress/integration/plugins/ui/menu.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,54 @@ test('keyboard controls',
},
)

test('keyboard controls with x-teleport',
[html`
<div x-data x-menu>
<span>
<button x-menu:button trigger>
<span>Options</span>
</button>
</span>

<template x-teleport="body">
<div x-menu:items items>
<a x-menu:item href="#account-settings" :class="$menuItem.isActive && 'active'">
Account settings
</a>
<a x-menu:item href="#support" :class="$menuItem.isActive && 'active'">
Support
</a>
</div>
</template>
</div>`],
({ 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`
<div x-data x-menu>
Expand Down
Loading