Skip to content

Commit ce04121

Browse files
Merge pull request #53214 from nextcloud/dependabot/npm_and_yarn/stable31/nextcloud/vue-8.27.0
2 parents d090627 + c680411 commit ce04121

File tree

210 files changed

+426
-304
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

210 files changed

+426
-304
lines changed

apps/files/src/services/HotKeysService.spec.ts

Lines changed: 37 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ describe('HotKeysService testing', () => {
6161
activeStore.setActiveNode(file)
6262

6363
window.OCA = { Files: { Sidebar: { open: () => {}, setActiveTab: () => {} } } }
64-
// @ts-expect-error We only mock what needed, we do not need Files.Router.goTo or Files.Navigation
64+
// We only mock what needed, we do not need Files.Router.goTo or Files.Navigation
6565
window.OCP = { Files: { Router: { goToRoute: goToRouteMock, params: {}, query: {} } } }
6666

6767
initialState = document.createElement('input')
@@ -74,55 +74,56 @@ describe('HotKeysService testing', () => {
7474
})
7575

7676
it('Pressing d should open the sidebar once', () => {
77-
window.dispatchEvent(new KeyboardEvent('keydown', { key: 'd', code: 'KeyD' }))
77+
dispatchEvent({ key: 'd', code: 'KeyD' })
7878

7979
// Modifier keys should not trigger the action
80-
window.dispatchEvent(new KeyboardEvent('keydown', { key: 'd', code: 'KeyD', ctrlKey: true }))
81-
window.dispatchEvent(new KeyboardEvent('keydown', { key: 'd', code: 'KeyD', altKey: true }))
82-
window.dispatchEvent(new KeyboardEvent('keydown', { key: 'd', code: 'KeyD', shiftKey: true }))
83-
window.dispatchEvent(new KeyboardEvent('keydown', { key: 'd', code: 'KeyD', metaKey: true }))
80+
dispatchEvent({ key: 'd', code: 'KeyD', ctrlKey: true })
81+
dispatchEvent({ key: 'd', code: 'KeyD', altKey: true })
82+
dispatchEvent({ key: 'd', code: 'KeyD', shiftKey: true })
83+
dispatchEvent({ key: 'd', code: 'KeyD', metaKey: true })
8484

8585
expect(sidebarAction.enabled).toHaveReturnedWith(true)
8686
expect(sidebarAction.exec).toHaveBeenCalledOnce()
8787
})
8888

8989
it('Pressing F2 should rename the file', () => {
90-
window.dispatchEvent(new KeyboardEvent('keydown', { key: 'F2', code: 'F2' }))
90+
dispatchEvent({ key: 'F2', code: 'F2' })
9191

9292
// Modifier keys should not trigger the action
93-
window.dispatchEvent(new KeyboardEvent('keydown', { key: 'F2', code: 'F2', ctrlKey: true }))
94-
window.dispatchEvent(new KeyboardEvent('keydown', { key: 'F2', code: 'F2', altKey: true }))
95-
window.dispatchEvent(new KeyboardEvent('keydown', { key: 'F2', code: 'F2', shiftKey: true }))
96-
window.dispatchEvent(new KeyboardEvent('keydown', { key: 'F2', code: 'F2', metaKey: true }))
93+
dispatchEvent({ key: 'F2', code: 'F2', ctrlKey: true })
94+
dispatchEvent({ key: 'F2', code: 'F2', altKey: true })
95+
dispatchEvent({ key: 'F2', code: 'F2', shiftKey: true })
96+
dispatchEvent({ key: 'F2', code: 'F2', metaKey: true })
9797

9898
expect(renameAction.enabled).toHaveReturnedWith(true)
9999
expect(renameAction.exec).toHaveBeenCalledOnce()
100100
})
101101

102102
it('Pressing s should toggle favorite', () => {
103103
vi.spyOn(axios, 'post').mockImplementationOnce(() => Promise.resolve())
104-
window.dispatchEvent(new KeyboardEvent('keydown', { key: 's', code: 'KeyS' }))
104+
dispatchEvent({ key: 's', code: 'KeyS' })
105105

106106
// Modifier keys should not trigger the action
107-
window.dispatchEvent(new KeyboardEvent('keydown', { key: 's', code: 'KeyS', ctrlKey: true }))
108-
window.dispatchEvent(new KeyboardEvent('keydown', { key: 's', code: 'KeyS', altKey: true }))
109-
window.dispatchEvent(new KeyboardEvent('keydown', { key: 's', code: 'KeyS', shiftKey: true }))
110-
window.dispatchEvent(new KeyboardEvent('keydown', { key: 's', code: 'KeyS', metaKey: true }))
107+
dispatchEvent({ key: 's', code: 'KeyS', ctrlKey: true })
108+
dispatchEvent({ key: 's', code: 'KeyS', altKey: true })
109+
dispatchEvent({ key: 's', code: 'KeyS', shiftKey: true })
110+
dispatchEvent({ key: 's', code: 'KeyS', metaKey: true })
111111

112112
expect(favoriteAction.enabled).toHaveReturnedWith(true)
113113
expect(favoriteAction.exec).toHaveBeenCalledOnce()
114114
})
115115

116116
it('Pressing Delete should delete the file', async () => {
117+
// @ts-expect-error unit testing
117118
vi.spyOn(deleteAction._action, 'exec').mockResolvedValue(() => true)
118119

119-
window.dispatchEvent(new KeyboardEvent('keydown', { key: 'Delete', code: 'Delete' }))
120+
dispatchEvent({ key: 'Delete', code: 'Delete' })
120121

121122
// Modifier keys should not trigger the action
122-
window.dispatchEvent(new KeyboardEvent('keydown', { key: 'Delete', code: 'Delete', ctrlKey: true }))
123-
window.dispatchEvent(new KeyboardEvent('keydown', { key: 'Delete', code: 'Delete', altKey: true }))
124-
window.dispatchEvent(new KeyboardEvent('keydown', { key: 'Delete', code: 'Delete', shiftKey: true }))
125-
window.dispatchEvent(new KeyboardEvent('keydown', { key: 'Delete', code: 'Delete', metaKey: true }))
123+
dispatchEvent({ key: 'Delete', code: 'Delete', ctrlKey: true })
124+
dispatchEvent({ key: 'Delete', code: 'Delete', altKey: true })
125+
dispatchEvent({ key: 'Delete', code: 'Delete', shiftKey: true })
126+
dispatchEvent({ key: 'Delete', code: 'Delete', metaKey: true })
126127

127128
expect(deleteAction.enabled).toHaveReturnedWith(true)
128129
expect(deleteAction.exec).toHaveBeenCalledOnce()
@@ -132,7 +133,7 @@ describe('HotKeysService testing', () => {
132133
expect(goToRouteMock).toHaveBeenCalledTimes(0)
133134
window.OCP.Files.Router.query = { dir: '/foo/bar' }
134135

135-
window.dispatchEvent(new KeyboardEvent('keydown', { key: 'ArrowUp', code: 'ArrowUp', altKey: true }))
136+
dispatchEvent({ key: 'ArrowUp', code: 'ArrowUp', altKey: true })
136137

137138
expect(goToRouteMock).toHaveBeenCalledOnce()
138139
expect(goToRouteMock.mock.calls[0][2].dir).toBe('/foo')
@@ -151,25 +152,34 @@ describe('HotKeysService testing', () => {
151152
setTimeout(resolve, 500)
152153
})
153154

154-
window.dispatchEvent(new KeyboardEvent('keydown', { key: 'v', code: 'KeyV' }))
155+
dispatchEvent({ key: 'v', code: 'KeyV' })
155156
await waitForUserConfig()
156157
expect(userConfigStore.userConfig.grid_view).toBe(!currentGridConfig)
157158

158159
// Modifier keys should not trigger the action
159-
window.dispatchEvent(new KeyboardEvent('keydown', { key: 'Delete', code: 'Delete', ctrlKey: true }))
160+
dispatchEvent({ key: 'Delete', code: 'Delete', ctrlKey: true })
160161
await waitForUserConfig()
161162
expect(userConfigStore.userConfig.grid_view).toBe(!currentGridConfig)
162163

163-
window.dispatchEvent(new KeyboardEvent('keydown', { key: 'Delete', code: 'Delete', altKey: true }))
164+
dispatchEvent({ key: 'Delete', code: 'Delete', altKey: true })
164165
await waitForUserConfig()
165166
expect(userConfigStore.userConfig.grid_view).toBe(!currentGridConfig)
166167

167-
window.dispatchEvent(new KeyboardEvent('keydown', { key: 'Delete', code: 'Delete', shiftKey: true }))
168+
dispatchEvent({ key: 'Delete', code: 'Delete', shiftKey: true })
168169
await waitForUserConfig()
169170
expect(userConfigStore.userConfig.grid_view).toBe(!currentGridConfig)
170171

171-
window.dispatchEvent(new KeyboardEvent('keydown', { key: 'Delete', code: 'Delete', metaKey: true }))
172+
dispatchEvent({ key: 'Delete', code: 'Delete', metaKey: true })
172173
await waitForUserConfig()
173174
expect(userConfigStore.userConfig.grid_view).toBe(!currentGridConfig)
174175
})
175176
})
177+
178+
/**
179+
* Helper to dispatch the correct event.
180+
*
181+
* @param init - KeyboardEvent options
182+
*/
183+
function dispatchEvent(init: KeyboardEventInit) {
184+
document.body.dispatchEvent(new KeyboardEvent('keydown', { ...init, bubbles: true }))
185+
}

apps/systemtags/src/services/HotKeysService.spec.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,24 @@ describe('HotKeysService testing', () => {
4242
})
4343

4444
it('Pressing t should open the tag management dialog', () => {
45-
window.dispatchEvent(new KeyboardEvent('keydown', { key: 't', code: 'KeyT' }))
45+
dispatchEvent({ key: 't', code: 'KeyT' })
4646

4747
// Modifier keys should not trigger the action
48-
window.dispatchEvent(new KeyboardEvent('keydown', { key: 't', code: 'KeyT', ctrlKey: true }))
49-
window.dispatchEvent(new KeyboardEvent('keydown', { key: 't', code: 'KeyT', altKey: true }))
50-
window.dispatchEvent(new KeyboardEvent('keydown', { key: 't', code: 'KeyT', shiftKey: true }))
51-
window.dispatchEvent(new KeyboardEvent('keydown', { key: 't', code: 'KeyT', metaKey: true }))
48+
dispatchEvent({ key: 't', code: 'KeyT', ctrlKey: true })
49+
dispatchEvent({ key: 't', code: 'KeyT', altKey: true })
50+
dispatchEvent({ key: 't', code: 'KeyT', shiftKey: true })
51+
dispatchEvent({ key: 't', code: 'KeyT', metaKey: true })
5252

5353
expect(bulkSystemTagsAction.enabled).toHaveReturnedWith(true)
5454
expect(bulkSystemTagsAction.exec).toHaveBeenCalledOnce()
5555
})
5656
})
57+
58+
/**
59+
* Helper to dispatch the correct event.
60+
*
61+
* @param init - KeyboardEvent options
62+
*/
63+
function dispatchEvent(init: KeyboardEventInit) {
64+
document.body.dispatchEvent(new KeyboardEvent('keydown', { ...init, bubbles: true }))
65+
}

apps/systemtags/src/services/HotKeysService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
33
* SPDX-License-Identifier: AGPL-3.0-or-later
44
*/
5-
import { useHotKey } from '@nextcloud/vue/dist/Composables/useHotKey.js'
5+
import { useHotKey } from '@nextcloud/vue/composables/useHotKey'
66

77
import { action as manageTagAction } from '../files_actions/bulkSystemTagsAction.ts'
88
import { executeAction } from '../../../files/src/utils/actionUtils.ts'

cypress/e2e/files/favorites.cy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ describe('files: Favorites', { testIsolation: true }, () => {
3030
// See action is called 'Add to favorites'
3131
cy.get('[data-cy-files-list-row-action="favorite"] > button').last()
3232
.should('exist')
33-
.and('have.text', 'Add to favorites')
33+
.and('contain.text', 'Add to favorites')
3434
.click({ force: true })
3535
cy.wait('@addToFavorites')
3636
// See favorites star

dist/1642-1642.js.license

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ This file is generated from multiple sources. Included packages:
5151
- version: 3.0.1
5252
- license: GPL-3.0-or-later
5353
- @nextcloud/vue
54-
- version: 8.26.1
54+
- version: 8.27.0
5555
- license: AGPL-3.0-or-later
5656
- @vueuse/core
5757
- version: 11.3.0

dist/2452-2452.js.license

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ This file is generated from multiple sources. Included packages:
4545
- version: 3.0.1
4646
- license: GPL-3.0-or-later
4747
- @nextcloud/vue
48-
- version: 8.26.1
48+
- version: 8.27.0
4949
- license: AGPL-3.0-or-later
5050
- @vueuse/core
5151
- version: 11.3.0

dist/3179-3179.js.license

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ This file is generated from multiple sources. Included packages:
6060
- version: 3.0.1
6161
- license: GPL-3.0-or-later
6262
- @nextcloud/vue
63-
- version: 8.26.1
63+
- version: 8.27.0
6464
- license: AGPL-3.0-or-later
6565
- @vueuse/components
6666
- version: 11.3.0

dist/3303-3303.js.license

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ This file is generated from multiple sources. Included packages:
2828
- version: 3.0.1
2929
- license: GPL-3.0-or-later
3030
- @nextcloud/vue
31-
- version: 8.26.1
31+
- version: 8.27.0
3232
- license: AGPL-3.0-or-later
3333
- @vueuse/core
3434
- version: 11.3.0

dist/3920-3920.js.license

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ This file is generated from multiple sources. Included packages:
9393
- version: 3.0.1
9494
- license: GPL-3.0-or-later
9595
- @nextcloud/vue
96-
- version: 8.26.1
96+
- version: 8.27.0
9797
- license: AGPL-3.0-or-later
9898
- @vue/devtools-api
9999
- version: 6.6.3

dist/4107-4107.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)