From 552dd5a4cf76540ca40facd0ff5ff6da73ca6cfe Mon Sep 17 00:00:00 2001 From: Paul Neubauer Date: Wed, 18 Jan 2023 09:37:16 +0100 Subject: [PATCH] [full-ci] Extend multiple space selection details (#8230) * Extend multiple space selection details * Redesign component, fix translation * Implement unittests * Fix unittest * Add PR to changelog * Address PR issues * Add enabled disabled info, fix bug * Update snapshot * Update changelog * Address PR issues --- .../enhancement-spaces-list-in-admin-settings | 1 + .../src/views/Spaces.vue | 5 +- .../Spaces/Details/SpaceDetailsMultiple.vue | 144 ++++++++++++++++-- .../Details/SpaceDetailsMultiple.spec.ts | 34 +++++ .../SpaceDetailsMultiple.spec.ts.snap | 38 +++++ 5 files changed, 212 insertions(+), 10 deletions(-) create mode 100644 packages/web-pkg/tests/unit/components/sidebar/Spaces/Details/SpaceDetailsMultiple.spec.ts create mode 100644 packages/web-pkg/tests/unit/components/sidebar/Spaces/Details/__snapshots__/SpaceDetailsMultiple.spec.ts.snap diff --git a/changelog/unreleased/enhancement-spaces-list-in-admin-settings b/changelog/unreleased/enhancement-spaces-list-in-admin-settings index 2b4a3fb5aa1..d2c5bfd9540 100644 --- a/changelog/unreleased/enhancement-spaces-list-in-admin-settings +++ b/changelog/unreleased/enhancement-spaces-list-in-admin-settings @@ -15,4 +15,5 @@ https://github.com/owncloud/web/pull/8236 https://github.com/owncloud/web/pull/8238 https://github.com/owncloud/web/pull/8234 https://github.com/owncloud/web/pull/8249 +https://github.com/owncloud/web/pull/8230 https://github.com/owncloud/web/issues/8219 diff --git a/packages/web-app-admin-settings/src/views/Spaces.vue b/packages/web-app-admin-settings/src/views/Spaces.vue index e5bd0efa237..6aba7b57a60 100644 --- a/packages/web-app-admin-settings/src/views/Spaces.vue +++ b/packages/web-app-admin-settings/src/views/Spaces.vue @@ -172,7 +172,10 @@ export default defineComponent({ title: $gettext('Space details'), component: SpaceDetailsMultiple, default: true, - enabled: unref(selectedSpaces).length > 1 + enabled: unref(selectedSpaces).length > 1, + componentAttrs: { + selectedSpaces: unref(selectedSpaces) + } }, { app: 'SpaceMembers', diff --git a/packages/web-pkg/src/components/sideBar/Spaces/Details/SpaceDetailsMultiple.vue b/packages/web-pkg/src/components/sideBar/Spaces/Details/SpaceDetailsMultiple.vue index 8f4b1560f58..51465a77564 100644 --- a/packages/web-pkg/src/components/sideBar/Spaces/Details/SpaceDetailsMultiple.vue +++ b/packages/web-pkg/src/components/sideBar/Spaces/Details/SpaceDetailsMultiple.vue @@ -1,21 +1,147 @@ diff --git a/packages/web-pkg/tests/unit/components/sidebar/Spaces/Details/SpaceDetailsMultiple.spec.ts b/packages/web-pkg/tests/unit/components/sidebar/Spaces/Details/SpaceDetailsMultiple.spec.ts new file mode 100644 index 00000000000..84855e8e883 --- /dev/null +++ b/packages/web-pkg/tests/unit/components/sidebar/Spaces/Details/SpaceDetailsMultiple.spec.ts @@ -0,0 +1,34 @@ +import SpaceDetailsMultiple from 'web-pkg/src/components/sideBar/Spaces/Details/SpaceDetailsMultiple.vue' +import { defaultPlugins, shallowMount } from 'web-test-helpers' + +const spaceMock = { + type: 'space', + name: ' space', + id: '1', + mdate: 'Wed, 21 Oct 2015 07:28:00 GMT', + spaceQuota: { + used: 100, + total: 1000, + remaining: 900 + } +} + +describe('Multiple Details SideBar Panel', () => { + it('displays the details side panel', () => { + const { wrapper } = createWrapper(spaceMock) + expect(wrapper.html()).toMatchSnapshot() + }) +}) + +function createWrapper(spaceResource) { + return { + wrapper: shallowMount(SpaceDetailsMultiple, { + global: { + plugins: [...defaultPlugins()] + }, + props: { + selectedSpaces: [spaceResource] + } + }) + } +} diff --git a/packages/web-pkg/tests/unit/components/sidebar/Spaces/Details/__snapshots__/SpaceDetailsMultiple.spec.ts.snap b/packages/web-pkg/tests/unit/components/sidebar/Spaces/Details/__snapshots__/SpaceDetailsMultiple.spec.ts.snap new file mode 100644 index 00000000000..5ad44e2d0d9 --- /dev/null +++ b/packages/web-pkg/tests/unit/components/sidebar/Spaces/Details/__snapshots__/SpaceDetailsMultiple.spec.ts.snap @@ -0,0 +1,38 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Multiple Details SideBar Panel displays the details side panel 1`] = ` +
+
+
+ +

1 space selected

+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + +
Total quota:1 kB
Remaining quota:900 B
Used quota:100 B
Enabled:1
Disabled:0
+
+
+`;