From 32beb5d72ffb61eed2bdd75bf12ad05bae445ac5 Mon Sep 17 00:00:00 2001 From: Grigorii Shartsev Date: Tue, 28 Mar 2023 03:35:09 +0200 Subject: [PATCH] fix(NcAppSIdebarTabs): fix dynamic tabs registration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix: #3461 Signed-off-by: Grigorii Shartsev Co-authored-by: Raimund Schlüßler --- src/components/NcAppSidebar/NcAppSidebar.vue | 120 +++++++++++++++--- .../NcAppSidebar/NcAppSidebarTabs.vue | 106 +++++----------- .../NcAppSidebarTab/NcAppSidebarTab.vue | 26 +++- .../NcAppSidebar/NcAppSidebarTabs.spec.js | 19 --- 4 files changed, 162 insertions(+), 109 deletions(-) diff --git a/src/components/NcAppSidebar/NcAppSidebar.vue b/src/components/NcAppSidebar/NcAppSidebar.vue index 7551fbdbbb..1bbf50c0f3 100644 --- a/src/components/NcAppSidebar/NcAppSidebar.vue +++ b/src/components/NcAppSidebar/NcAppSidebar.vue @@ -31,22 +31,33 @@ include a standard-header like it's used by the files app. ```vue ``` +### One tab + +```vue + + +``` + +### One or two tabs with condition + +```vue + + +``` + ### Editable title ```vue diff --git a/src/components/NcAppSidebar/NcAppSidebarTabs.vue b/src/components/NcAppSidebar/NcAppSidebarTabs.vue index deec2b0a10..e94762ec01 100644 --- a/src/components/NcAppSidebar/NcAppSidebarTabs.vue +++ b/src/components/NcAppSidebar/NcAppSidebarTabs.vue @@ -47,8 +47,7 @@ role="tab" @click.prevent="setActive(tab.id)"> - - + {{ tab.name }} @@ -67,16 +66,6 @@ diff --git a/tests/unit/components/NcAppSidebar/NcAppSidebarTabs.spec.js b/tests/unit/components/NcAppSidebar/NcAppSidebarTabs.spec.js index 201de12edd..2f20724c31 100644 --- a/tests/unit/components/NcAppSidebar/NcAppSidebarTabs.spec.js +++ b/tests/unit/components/NcAppSidebar/NcAppSidebarTabs.spec.js @@ -189,23 +189,4 @@ describe('NcAppSidebarTabs.vue', () => { }) }) }) - describe('when tabs and other elements are mixed', () => { - it('Issues a warning and logs to console .', () => { - mount(NcAppSidebarTabs, { - slots: { - default: [ - 'Tab1', - 'Tab2', - '
Non-tab-content
', - 'Test', - ], - }, - stubs: { - NcAppSidebarTab, - }, - }) - expect(onWarning).toHaveBeenCalledTimes(1) - expect(consoleDebug).toHaveBeenCalledTimes(2) - }) - }) })