Skip to content
Merged
Show file tree
Hide file tree
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
12 changes: 6 additions & 6 deletions build/frontend-legacy/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/frontend-legacy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"@nextcloud/router": "^3.2.0",
"@nextcloud/sharing": "^1.0.0-beta.4",
"@nextcloud/upload": "^1.12.0",
"@nextcloud/vue": "^8.41.0",
"@nextcloud/vue": "^8.42.0",
"@simplewebauthn/browser": "^13.3.0",
"@vue/web-component-wrapper": "^1.3.0",
"@vueuse/components": "^11.3.0",
Expand Down
15 changes: 11 additions & 4 deletions core/src/tests/components/AppMenu.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import type { INavigationEntry } from '../../types/navigation.d.ts'

import { mount } from '@vue/test-utils'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { afterEach, beforeEach, describe, expect, it, onTestFinished, vi } from 'vitest'

// Hoisted so mocks exist before the SFC's imports run.
const initialState = vi.hoisted(() => ({
Expand Down Expand Up @@ -234,9 +234,10 @@ describe('core: AppMenu', () => {
})

it('returnFocusTarget points at the trigger that opened the popover', async () => {
// focus-trap doesn't activate in jsdom (needs layout), so we can't assert
// on document.activeElement. Instead we call returnFocusTarget() directly
// (the same method NcPopover calls on deactivation).
// jsdom has no layout, so focus-trap finds no tabbable node and falls
// back to the popover root; we can't assert on document.activeElement.
// Instead we call returnFocusTarget() directly (the same method
// NcPopover calls on deactivation).
const wrapper = mount(AppMenu, { attachTo: document.body })
await wrapper.get('.app-menu__current-app').trigger('click')

Expand Down Expand Up @@ -625,6 +626,12 @@ describe('core: AppMenu navigation actions', () => {
})

it('focuses the first submenu entry on open and navigates it with arrow keys', async () => {
// jsdom has no layout, so tabbable (used by focus-trap) treats every node
// as hidden and the submenu trap falls back to the popover root. Report a
// box so the trap picks the first entry, as it does in a browser.
const rects = vi.spyOn(HTMLElement.prototype, 'getClientRects')
.mockReturnValue([{}] as unknown as DOMRectList)
onTestFinished(() => rects.mockRestore())
initialState.loadState.mockImplementation(stateWith(fakeApps(), fakeActions(6)))
const wrapper = mount(AppMenu, { attachTo: document.body })
await openPopover(wrapper)
Expand Down
Loading