From 9788b6e867b1a51c4a3d51cc3a4ac7950595354b Mon Sep 17 00:00:00 2001 From: Jannik Stehle Date: Tue, 26 Mar 2024 17:00:00 +0100 Subject: [PATCH 1/3] test: fix type for CollaboratorListItem stub --- .../tests/unit/components/SideBar/Shares/FileShares.spec.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/web-app-files/tests/unit/components/SideBar/Shares/FileShares.spec.ts b/packages/web-app-files/tests/unit/components/SideBar/Shares/FileShares.spec.ts index a9940442d4f..dfb20484ec2 100644 --- a/packages/web-app-files/tests/unit/components/SideBar/Shares/FileShares.spec.ts +++ b/packages/web-app-files/tests/unit/components/SideBar/Shares/FileShares.spec.ts @@ -75,7 +75,9 @@ describe('FileShares', () => { it('reacts on delete events', async () => { const { wrapper } = getWrapper({ collaborators }) const { dispatchModal } = useModals() - ;(wrapper.findComponent('collaborator-list-item-stub').vm as any).$emit('onDelete') + wrapper + .findComponent('collaborator-list-item-stub') + .vm.$emit('onDelete') await wrapper.vm.$nextTick() expect(dispatchModal).toHaveBeenCalledTimes(1) }) From b2a0dd42eb250c2cd9242b8fdcd5a912484d26fb Mon Sep 17 00:00:00 2001 From: Jannik Stehle Date: Tue, 26 Mar 2024 17:18:19 +0100 Subject: [PATCH 2/3] refactor: remove unnecessary promise resolvers --- .../src/components/SideBar/Shares/Links/DetailsAndEdit.vue | 7 ++++--- packages/web-pkg/src/composables/piniaStores/modals.ts | 2 +- packages/web-runtime/src/components/ModalWrapper.vue | 4 +++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/packages/web-app-files/src/components/SideBar/Shares/Links/DetailsAndEdit.vue b/packages/web-app-files/src/components/SideBar/Shares/Links/DetailsAndEdit.vue index 6e800c157eb..07ffaaab187 100644 --- a/packages/web-app-files/src/components/SideBar/Shares/Links/DetailsAndEdit.vue +++ b/packages/web-app-files/src/components/SideBar/Shares/Links/DetailsAndEdit.vue @@ -494,7 +494,7 @@ export default defineComponent({ onConfirm: (displayName: string) => { const linkShare = this.linkShare linkShare.displayName = displayName - return Promise.resolve(this.$emit('updateLink', { linkShare })) + this.$emit('updateLink', { linkShare }) } }) }, @@ -521,8 +521,9 @@ export default defineComponent({ inputLabel: this.$gettext('Email address'), inputType: 'email', onInput: (value, setError) => setError(this.getEmailValidationMsg(value)), - onConfirm: (value: string) => - Promise.resolve(this.$emit('updateLink', { linkShare: { ...this.linkShare } })) + onConfirm: () => { + this.$emit('updateLink', { linkShare: { ...this.linkShare } }) + } }) }, getEmailValidationMsg(email: string) { diff --git a/packages/web-pkg/src/composables/piniaStores/modals.ts b/packages/web-pkg/src/composables/piniaStores/modals.ts index 3b05987b5a3..15edf177895 100644 --- a/packages/web-pkg/src/composables/piniaStores/modals.ts +++ b/packages/web-pkg/src/composables/piniaStores/modals.ts @@ -46,7 +46,7 @@ export type Modal = { customComponent?: CustomModalComponent customComponentAttrs?: () => Record onCancel?: () => void - onConfirm?: (value: string) => Promise + onConfirm?: (value: string) => void | Promise onInput?: (value: string, setError: (error: string) => void) => void } diff --git a/packages/web-runtime/src/components/ModalWrapper.vue b/packages/web-runtime/src/components/ModalWrapper.vue index b4d6c724021..08ab553244d 100644 --- a/packages/web-runtime/src/components/ModalWrapper.vue +++ b/packages/web-runtime/src/components/ModalWrapper.vue @@ -60,7 +60,9 @@ export default defineComponent({ updateModal(unref(modal)?.id, 'confirmDisabled', true) if (unref(modal)?.onConfirm) { - await loadingService.addTask(() => unref(modal).onConfirm(value)) + await loadingService.addTask(async () => { + await unref(modal).onConfirm(value) + }) } else if (unref(customComponentRef)?.onConfirm) { await loadingService.addTask(() => unref(customComponentRef).onConfirm()) } From 70afc3670db6d14bf442819b713f816ce0b89c2a Mon Sep 17 00:00:00 2001 From: Jannik Stehle Date: Tue, 26 Mar 2024 17:28:24 +0100 Subject: [PATCH 3/3] test: clarify folder naming in e2e test --- .../cucumber/features/shares/share.feature | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/tests/e2e/cucumber/features/shares/share.feature b/tests/e2e/cucumber/features/shares/share.feature index ababa9fab55..c59160d74b7 100644 --- a/tests/e2e/cucumber/features/shares/share.feature +++ b/tests/e2e/cucumber/features/shares/share.feature @@ -12,27 +12,27 @@ Feature: share Given "Brian" disables auto-accepting using API And "Alice" logs in And "Alice" creates the following folder in personal space using API - | name | - | folder_to_shared | - | folder_to_customShared | - | shared_folder | + | name | + | folder_to_shared | + | folder_to_shared_2 | + | shared_folder | And "Alice" opens the "files" app And "Alice" uploads the following resource - | resource | to | - | lorem.txt | folder_to_shared | - | lorem-big.txt | folder_to_customShared | + | resource | to | + | lorem.txt | folder_to_shared | + | lorem-big.txt | folder_to_shared_2 | When "Alice" shares the following resource using the sidebar panel - | resource | recipient | type | role | resourceType | - | folder_to_shared | Brian | user | Can edit | folder | - | shared_folder | Brian | user | Can edit | folder | - | folder_to_customShared | Brian | user | Can edit | folder | + | resource | recipient | type | role | resourceType | + | folder_to_shared | Brian | user | Can edit | folder | + | shared_folder | Brian | user | Can edit | folder | + | folder_to_shared_2 | Brian | user | Can edit | folder | And "Brian" opens the "files" app And "Brian" navigates to the shared with me page And "Brian" enables the sync for the following shares - | name | - | folder_to_shared | - | folder_to_customShared | + | name | + | folder_to_shared | + | folder_to_shared_2 | Then "Brian" should not see a sync status for the folder "shared_folder" When "Brian" enables the sync for the following share using the context menu | name | @@ -44,12 +44,12 @@ Feature: share | resource | as | | folder_to_shared/lorem.txt | lorem_new.txt | And "Brian" uploads the following resource - | resource | to | - | simple.pdf | folder_to_shared | - | testavatar.jpeg | folder_to_customShared | + | resource | to | + | simple.pdf | folder_to_shared | + | testavatar.jpeg | folder_to_shared_2 | When "Brian" deletes the following resources using the sidebar panel - | resource | from | - | lorem-big.txt | folder_to_customShared | + | resource | from | + | lorem-big.txt | folder_to_shared_2 | And "Alice" opens the "files" app And "Alice" uploads the following resource | resource | to | option | @@ -58,17 +58,17 @@ Feature: share | resource | to | | simple.pdf | folder_to_shared | And "Alice" removes following sharee - | resource | recipient | - | folder_to_customShared | Brian | + | resource | recipient | + | folder_to_shared_2 | Brian | When "Alice" deletes the following resources using the sidebar panel | resource | from | | lorem_new.txt | folder_to_shared | | folder_to_shared | | And "Alice" logs out Then "Brian" should not be able to see the following shares - | resource | owner | - | folder_to_customShared | Alice Hansen | - | folder_to_shared | Alice Hansen | + | resource | owner | + | folder_to_shared_2 | Alice Hansen | + | folder_to_shared | Alice Hansen | And "Brian" logs out