summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/files/src/actions/openFolderAction.spec.ts8
-rw-r--r--apps/files/src/actions/sidebarAction.spec.ts14
-rw-r--r--apps/files/src/actions/viewInFolderAction.spec.ts4
-rw-r--r--apps/files_sharing/src/actions/openInFilesAction.spec.ts12
-rw-r--r--apps/files_sharing/src/actions/openInFilesAction.ts2
5 files changed, 26 insertions, 14 deletions
diff --git a/apps/files/src/actions/openFolderAction.spec.ts b/apps/files/src/actions/openFolderAction.spec.ts
index 5a0ccc98978..49fc9a9a63a 100644
--- a/apps/files/src/actions/openFolderAction.spec.ts
+++ b/apps/files/src/actions/openFolderAction.spec.ts
@@ -19,11 +19,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
-import { action } from './openFolderAction'
+import type { Navigation } from '../services/Navigation'
+
import { expect } from '@jest/globals'
import { File, Folder, Node, Permission } from '@nextcloud/files'
+
+import { action } from './openFolderAction'
import { DefaultType, FileAction } from '../services/FileAction'
-import type { Navigation } from '../services/Navigation'
const view = {
id: 'files',
@@ -132,7 +134,7 @@ describe('Open folder action execute tests', () => {
// Silent action
expect(exec).toBe(null)
expect(goToRouteMock).toBeCalledTimes(1)
- expect(goToRouteMock).toBeCalledWith(null, null, { dir: '/FooBar' })
+ expect(goToRouteMock).toBeCalledWith(null, { fileid: undefined, view: 'files' }, { dir: '/FooBar' })
})
test('Open folder fails without node', async () => {
diff --git a/apps/files/src/actions/sidebarAction.spec.ts b/apps/files/src/actions/sidebarAction.spec.ts
index 69eabe4be79..6b33667d1dd 100644
--- a/apps/files/src/actions/sidebarAction.spec.ts
+++ b/apps/files/src/actions/sidebarAction.spec.ts
@@ -19,11 +19,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
-import { action } from './sidebarAction'
+import type { Navigation } from '../services/Navigation'
+
import { expect } from '@jest/globals'
import { File, Permission } from '@nextcloud/files'
+
+import { action } from './sidebarAction'
import { FileAction } from '../services/FileAction'
-import type { Navigation } from '../services/Navigation'
import logger from '../logger'
const view = {
@@ -127,6 +129,8 @@ describe('Open sidebar action exec tests', () => {
test('Open sidebar', async () => {
const openMock = jest.fn()
window.OCA = { Files: { Sidebar: { open: openMock } } }
+ const goToRouteMock = jest.fn()
+ window.OCP = { Files: { Router: { goToRoute: goToRouteMock } } }
const file = new File({
id: 1,
@@ -139,6 +143,12 @@ describe('Open sidebar action exec tests', () => {
// Silent action
expect(exec).toBe(null)
expect(openMock).toBeCalledWith('/foobar.txt')
+ expect(goToRouteMock).toBeCalledWith(
+ null,
+ { view: view.id, fileid: 1 },
+ { dir: '/' },
+ true,
+ )
})
test('Open sidebar fails', async () => {
diff --git a/apps/files/src/actions/viewInFolderAction.spec.ts b/apps/files/src/actions/viewInFolderAction.spec.ts
index 887ed5d47c6..7d61fa4298d 100644
--- a/apps/files/src/actions/viewInFolderAction.spec.ts
+++ b/apps/files/src/actions/viewInFolderAction.spec.ts
@@ -128,7 +128,7 @@ describe('View in folder action execute tests', () => {
// Silent action
expect(exec).toBe(null)
expect(goToRouteMock).toBeCalledTimes(1)
- expect(goToRouteMock).toBeCalledWith(null, { fileid: 1, view: 'files' }, { fileid: 1, dir: '/' })
+ expect(goToRouteMock).toBeCalledWith(null, { fileid: 1, view: 'files' }, { dir: '/' })
})
test('View in (sub) folder', async () => {
@@ -148,7 +148,7 @@ describe('View in folder action execute tests', () => {
// Silent action
expect(exec).toBe(null)
expect(goToRouteMock).toBeCalledTimes(1)
- expect(goToRouteMock).toBeCalledWith(null, { fileid: 1, view: 'files' }, { fileid: 1, dir: '/Foo/Bar' })
+ expect(goToRouteMock).toBeCalledWith(null, { fileid: 1, view: 'files' }, { dir: '/Foo/Bar' })
})
test('View in folder fails without node', async () => {
diff --git a/apps/files_sharing/src/actions/openInFilesAction.spec.ts b/apps/files_sharing/src/actions/openInFilesAction.spec.ts
index 8920204ae3f..49d4e192d39 100644
--- a/apps/files_sharing/src/actions/openInFilesAction.spec.ts
+++ b/apps/files_sharing/src/actions/openInFilesAction.spec.ts
@@ -19,14 +19,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
-import { action } from './openInFilesAction'
+import type { Navigation } from '../../../files/src/services/Navigation'
+
import { expect } from '@jest/globals'
import { File, Permission } from '@nextcloud/files'
-import { DefaultType, FileAction } from '../../../files/src/services/FileAction'
-import * as eventBus from '@nextcloud/event-bus'
-import axios from '@nextcloud/axios'
-import type { Navigation } from '../../../files/src/services/Navigation'
+
import '../main'
+import { action } from './openInFilesAction'
+import { DefaultType, FileAction } from '../../../files/src/services/FileAction'
import { deletedSharesViewId, pendingSharesViewId, sharedWithOthersViewId, sharedWithYouViewId, sharesViewId, sharingByLinksViewId } from '../views/shares'
const view = {
@@ -92,6 +92,6 @@ describe('Open in files action execute tests', () => {
// Silent action
expect(exec).toBe(null)
expect(goToRouteMock).toBeCalledTimes(1)
- expect(goToRouteMock).toBeCalledWith(null, { fileid: 1, view: 'files' }, { fileid: 1, dir: '/Foo' })
+ expect(goToRouteMock).toBeCalledWith(null, { fileid: 1, view: 'files' }, { dir: '/Foo' })
})
})
diff --git a/apps/files_sharing/src/actions/openInFilesAction.ts b/apps/files_sharing/src/actions/openInFilesAction.ts
index bd9791e85a5..ff7ccde2f36 100644
--- a/apps/files_sharing/src/actions/openInFilesAction.ts
+++ b/apps/files_sharing/src/actions/openInFilesAction.ts
@@ -43,7 +43,7 @@ export const action = new FileAction({
window.OCP.Files.Router.goToRoute(
null, // use default route
{ view: 'files', fileid: node.fileid },
- { dir: node.dirname, fileid: node.fileid },
+ { dir: node.dirname },
)
return null
},