Skip to content

Commit 530f8b6

Browse files
Merge pull request #2272 from nextcloud-libraries/dependabot/npm_and_yarn/stable6/nextcloud/stylelint-config-3.2.1
chore(deps-dev): bump @nextcloud/stylelint-config from 3.1.1 to 3.2.1
2 parents 92b996d + 4636624 commit 530f8b6

4 files changed

Lines changed: 594 additions & 523 deletions

File tree

lib/components/FilePicker/FileListRow.spec.ts

Lines changed: 61 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1+
/* eslint-disable @typescript-eslint/no-explicit-any */
12
/**
23
* SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
34
* SPDX-License-Identifier: AGPL-3.0-or-later
45
*/
56

67
import type { Wrapper } from '@vue/test-utils'
7-
import type { ComponentProps } from 'vue-component-type-helpers'
88

99
import { afterEach, describe, expect, it, vi } from 'vitest'
1010
import { File, Folder, Permission } from '@nextcloud/files'
@@ -13,46 +13,9 @@ import { shallowMount } from '@vue/test-utils'
1313
import FileListRow from './FileListRow.vue'
1414
import { nextTick } from 'vue'
1515

16-
/* eslint-disable @typescript-eslint/no-explicit-any, jsdoc/require-jsdoc */
17-
1816
type SubmitAction = (wrapper: Wrapper<any>) => Promise<void>
1917
type ElementEvent = { 'update:selected': boolean | undefined, 'enter-directory': Folder | undefined }
20-
21-
async function clickCheckboxAction(wrapper: Wrapper<any>) {
22-
wrapper.find('input[type="checkbox"]').trigger('click')
23-
}
24-
25-
async function clickElementAction(wrapper: Wrapper<any>) {
26-
wrapper.find('[data-testid="row-name"]').trigger('click')
27-
}
28-
29-
async function pressEnterAction(wrapper: Wrapper<any>) {
30-
wrapper.element.dispatchEvent(new KeyboardEvent('keydown', { bubbles: true, key: 'Enter' }))
31-
await nextTick()
32-
}
33-
34-
function testSubmitNode(name: string, propsData: ComponentProps<typeof FileListRow>, eventPayload: ElementEvent, actionCallback: SubmitAction) {
35-
it(name, async () => {
36-
const wrapper = shallowMount(FileListRow as any, {
37-
propsData,
38-
stubs: {
39-
NcCheckboxRadioSwitch: {
40-
template: '<label><input type="checkbox" @click="$emit(\'update:model-value\', true)" ></label>',
41-
},
42-
},
43-
})
44-
45-
await actionCallback(wrapper)
46-
47-
for (const [event, payload] of Object.entries(eventPayload)) {
48-
if (payload === undefined) {
49-
expect(wrapper.emitted(event)).toBeUndefined()
50-
} else {
51-
expect(wrapper.emitted(event)).toEqual([[payload]])
52-
}
53-
}
54-
})
55-
}
18+
type FileListRowProps = InstanceType<typeof FileListRow>['$props']
5619

5720
const node = new File({
5821
owner: 'alice',
@@ -222,3 +185,62 @@ describe('FilePicker: FileListRow', () => {
222185
})
223186
})
224187
})
188+
189+
/**
190+
* Helper function to test the emitted events when submitting a node (file or folder)
191+
*
192+
* @param name - the name of the test case
193+
* @param propsData - the props to pass to the FileListRow component
194+
* @param eventPayload - the expected emitted events and their payloads
195+
* @param actionCallback - the action to perform to submit the node
196+
*/
197+
function testSubmitNode(name: string, propsData: FileListRowProps, eventPayload: ElementEvent, actionCallback: SubmitAction) {
198+
it(name, async () => {
199+
const wrapper = shallowMount(FileListRow as any, {
200+
propsData,
201+
stubs: {
202+
NcCheckboxRadioSwitch: {
203+
template: '<label><input type="checkbox" @click="$emit(\'update:model-value\', true)" ></label>',
204+
},
205+
},
206+
})
207+
208+
await actionCallback(wrapper)
209+
210+
for (const [event, payload] of Object.entries(eventPayload)) {
211+
if (payload === undefined) {
212+
expect(wrapper.emitted(event)).toBeUndefined()
213+
} else {
214+
expect(wrapper.emitted(event)).toEqual([[payload]])
215+
}
216+
}
217+
})
218+
}
219+
220+
/**
221+
* Click on the checkbox element
222+
*
223+
* @param wrapper - the wrapper of the FileListRow component
224+
*/
225+
async function clickCheckboxAction(wrapper: Wrapper<any>) {
226+
wrapper.find('input[type="checkbox"]').trigger('click')
227+
}
228+
229+
/**
230+
* Click on the row element
231+
*
232+
* @param wrapper - the wrapper of the FileListRow component
233+
*/
234+
async function clickElementAction(wrapper: Wrapper<any>) {
235+
wrapper.find('[data-testid="row-name"]').trigger('click')
236+
}
237+
238+
/**
239+
* Press Enter key on the row element
240+
*
241+
* @param wrapper - the wrapper of the FileListRow component
242+
*/
243+
async function pressEnterAction(wrapper: Wrapper<any>) {
244+
wrapper.element.dispatchEvent(new KeyboardEvent('keydown', { bubbles: true, key: 'Enter' }))
245+
await nextTick()
246+
}

lib/public-auth.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@
33
* SPDX-License-Identifier: AGPL-3.0-or-later
44
*/
55

6-
import type { ComponentProps } from 'vue-component-type-helpers'
76
import { defineAsyncComponent } from 'vue'
87
import { spawnDialog } from '@nextcloud/vue/functions/dialog'
98

109
import type PublicAuthPrompt from './components/PublicAuthPrompt.vue'
1110

12-
type PublicAuthPromptProps = ComponentProps<typeof PublicAuthPrompt>
11+
type PublicAuthPromptProps = InstanceType<typeof PublicAuthPrompt>['$props']
1312

1413
/**
1514
* Show the public auth prompt dialog

0 commit comments

Comments
 (0)