22 * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
33 * SPDX-License-Identifier: AGPL-3.0-or-later
44 */
5- import { describe , it , vi , expect , beforeEach , beforeAll } from 'vitest'
5+ import { describe , it , vi , expect , beforeEach , beforeAll , afterEach } from 'vitest'
66import { File , Permission , View } from '@nextcloud/files'
77import axios from '@nextcloud/axios'
88
@@ -33,6 +33,12 @@ describe('HotKeysService testing', () => {
3333
3434 const goToRouteMock = vi . fn ( )
3535
36+ let initialState : HTMLInputElement
37+
38+ afterEach ( ( ) => {
39+ document . body . removeChild ( initialState )
40+ } )
41+
3642 beforeAll ( ( ) => {
3743 registerHotkeys ( )
3844 } )
@@ -57,6 +63,14 @@ describe('HotKeysService testing', () => {
5763 window . OCA = { Files : { Sidebar : { open : ( ) => { } , setActiveTab : ( ) => { } } } }
5864 // @ts -expect-error We only mock what needed, we do not need Files.Router.goTo or Files.Navigation
5965 window . OCP = { Files : { Router : { goToRoute : goToRouteMock , params : { } , query : { } } } }
66+
67+ initialState = document . createElement ( 'input' )
68+ initialState . setAttribute ( 'type' , 'hidden' )
69+ initialState . setAttribute ( 'id' , 'initial-state-files_trashbin-config' )
70+ initialState . setAttribute ( 'value' , btoa ( JSON . stringify ( {
71+ allow_delete : true ,
72+ } ) ) )
73+ document . body . appendChild ( initialState )
6074 } )
6175
6276 it ( 'Pressing d should open the sidebar once' , ( ) => {
0 commit comments