diff --git a/packages/web-pkg/tests/unit/components/Modals/FilePickerModal.spec.ts b/packages/web-pkg/tests/unit/components/Modals/FilePickerModal.spec.ts
new file mode 100644
index 00000000000..286b866eda6
--- /dev/null
+++ b/packages/web-pkg/tests/unit/components/Modals/FilePickerModal.spec.ts
@@ -0,0 +1,77 @@
+import FilePickerModal from '../../../../src/components/Modals/FilePickerModal.vue'
+import { defaultComponentMocks, defaultPlugins, shallowMount } from 'web-test-helpers'
+import { mock } from 'vitest-mock-extended'
+import { Resource, SpaceResource } from '@ownclouders/web-client'
+import { Modal, useModals } from '../../../../src/composables/piniaStores'
+
+window.open = vi.fn()
+
+describe('FilePickerModal', () => {
+ describe('iframe', () => {
+ it('sets the iframe src correctly', () => {
+ const { wrapper } = getWrapper()
+ expect(wrapper.vm.iframeSrc).toEqual(
+ 'http://localhost:3000/files-spaces-generic?embed=true&embed-target=file&embed-file-types=text%2Cmd%2Ctext%2Frtf'
+ )
+ })
+ it('sets the iframe title correctly', () => {
+ const { wrapper } = getWrapper()
+ expect(wrapper.vm.iframeTitle).toEqual('ownCloud')
+ })
+ })
+ describe('method "onFilePick"', () => {
+ it('does nothing if the event message does not equal "owncloud-embed:file-pick"', () => {
+ const { wrapper } = getWrapper()
+ wrapper.vm.onFilePick(mock
({ data: { name: 'some-other-event' } }))
+ expect(window.open).not.toHaveBeenCalled()
+ })
+ it('opens resource in new window when message does equal "owncloud-embed:file-pick"', () => {
+ const { wrapper } = getWrapper()
+ const modalStore = useModals()
+ wrapper.vm.onFilePick(
+ mock({
+ data: { name: 'owncloud-embed:file-pick', data: mock({ storageId: '1' }) }
+ })
+ )
+ expect(modalStore.removeModal).toHaveBeenCalled()
+ expect(window.open).toHaveBeenCalled()
+ })
+ })
+})
+
+function getWrapper() {
+ const mocks = defaultComponentMocks()
+
+ return {
+ mocks,
+ wrapper: shallowMount(FilePickerModal, {
+ props: {
+ modal: mock(),
+ resource: mock(),
+ app: {
+ name: 'text-editor',
+ extensions: [{ extension: 'text' }, { extension: 'md' }, { mimeType: 'text/rtf' }]
+ },
+ parentFolderLink: {
+ name: 'files-spaces-generic',
+ params: {
+ driveAliasAndItem: 'personal/admin'
+ },
+ query: {
+ fileId:
+ '61dcd768-0bc4-4dd5-975a-2fe2bc9bc664$f1e4f3ec-1f24-460d-9f9a-4416ab6ddb6b!36cce768-8c9d-45e4-9c7d-4c9611962a75'
+ }
+ }
+ },
+ global: {
+ plugins: [
+ ...defaultPlugins({
+ piniaOptions: { spacesState: { spaces: [mock({ id: '1' })] } }
+ })
+ ],
+ mocks,
+ provide: mocks
+ }
+ })
+ }
+}
diff --git a/packages/web-pkg/tests/unit/composables/actions/files/useFileActionsOpenWithApp.spec.ts b/packages/web-pkg/tests/unit/composables/actions/files/useFileActionsOpenWithApp.spec.ts
new file mode 100644
index 00000000000..f3e32c2a621
--- /dev/null
+++ b/packages/web-pkg/tests/unit/composables/actions/files/useFileActionsOpenWithApp.spec.ts
@@ -0,0 +1,90 @@
+import { mock } from 'vitest-mock-extended'
+import { computed, unref } from 'vue'
+import { defaultComponentMocks, RouteLocation, getComposableWrapper } from 'web-test-helpers'
+import {
+ useFileActionsOpenWithApp,
+ useIsFilesAppActive,
+ useModals
+} from '../../../../../src/composables'
+import { Resource, SpaceResource } from '@ownclouders/web-client'
+import { ApplicationInformation } from '../../../../../src'
+
+vi.mock('../../../../../src/composables/actions/helpers/useIsFilesAppActive')
+
+const spaceMock = mock({
+ id: '1'
+})
+describe('openWithApp', () => {
+ describe('computed property "actions"', () => {
+ describe('method "isVisible"', () => {
+ it.each([
+ {
+ isFilesAppActive: false,
+ expectedStatus: true
+ },
+ {
+ isFilesAppActive: true,
+ expectedStatus: false
+ }
+ ])('should be set correctly', ({ isFilesAppActive, expectedStatus }) => {
+ getWrapper({
+ isFilesAppActive,
+ setup: ({ actions }) => {
+ expect(unref(actions)[0].isVisible()).toBe(expectedStatus)
+ }
+ })
+ })
+ })
+ describe('method "handler"', () => {
+ it('creates a modal', () => {
+ getWrapper({
+ setup: async ({ actions }) => {
+ const { dispatchModal } = useModals()
+ await unref(actions)[0].handler({
+ resources: [mock({ storageId: spaceMock.id, path: '/' })],
+ space: mock()
+ })
+ expect(dispatchModal).toHaveBeenCalled()
+ }
+ })
+ })
+ })
+ })
+})
+
+function getWrapper({
+ setup,
+ isFilesAppActive = false
+}: {
+ setup: (instance: ReturnType) => void
+ isFilesAppActive?: boolean
+}) {
+ vi.mocked(useIsFilesAppActive).mockReturnValueOnce(computed(() => isFilesAppActive))
+
+ const mocks = {
+ ...defaultComponentMocks({
+ currentRoute: mock({ name: 'text-editor' })
+ })
+ }
+
+ return {
+ wrapper: getComposableWrapper(
+ () => {
+ const instance = useFileActionsOpenWithApp({ appId: 'text-editor' })
+ setup(instance)
+ },
+ {
+ mocks,
+ provide: mocks,
+ pluginOptions: {
+ piniaOptions: {
+ spacesState: { spaces: [spaceMock] },
+ appsState: {
+ apps: { 'text-editor': mock({ name: 'text-editor' }) }
+ }
+ }
+ }
+ }
+ )
+ }
+}
diff --git a/packages/web-runtime/src/container/bootstrap.ts b/packages/web-runtime/src/container/bootstrap.ts
index 75b96c59c1c..cc89270acff 100644
--- a/packages/web-runtime/src/container/bootstrap.ts
+++ b/packages/web-runtime/src/container/bootstrap.ts
@@ -93,10 +93,10 @@ const getEmbedConfigFromQuery = (
config.target = embedTarget
}
- const embedExtensions = getQueryParam('embed-extensions')
+ const embedFileTypes = getQueryParam('embed-file-types')
- if (embedExtensions) {
- config.extensions = embedExtensions.split(',')
+ if (embedFileTypes) {
+ config.fileTypes = embedFileTypes.split(',')
}
const delegateAuthentication = getQueryParam('embed-delegate-authentication')