From 1654c900af8b701358b798d0fc186f2fedb2aba0 Mon Sep 17 00:00:00 2001 From: "Doberer, Johannes" Date: Fri, 1 Dec 2023 20:34:41 +0100 Subject: [PATCH 1/4] Enable override modalSettings when openNodeInModal --- core/src/services/routing.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/core/src/services/routing.js b/core/src/services/routing.js index 28b019ba76..e493af68ed 100644 --- a/core/src/services/routing.js +++ b/core/src/services/routing.js @@ -159,8 +159,8 @@ class RoutingClass { return LuigiConfig.getConfigValue('routing.useHashRouting') ? window.location.hash.replace('#', '') // TODO: GenericHelpers.getPathWithoutHash(window.location.hash) fails in ContextSwitcher : window.location.search - ? GenericHelpers.trimLeadingSlash(window.location.pathname) + window.location.search - : GenericHelpers.trimLeadingSlash(window.location.pathname); + ? GenericHelpers.trimLeadingSlash(window.location.pathname) + window.location.search + : GenericHelpers.trimLeadingSlash(window.location.pathname); } /** @@ -204,7 +204,7 @@ class RoutingClass { this.resolveUnsavedChanges(path, component, iframeElement, config, newUrl); }, // user clicks no, do nothing, reject promise - () => {} + () => { } ); } @@ -443,10 +443,10 @@ class RoutingClass { Object.assign({}, newNodeData, { previousNodeValues: previousCompData ? { - viewUrl: previousCompData.viewUrl, - isolateView: previousCompData.isolateView, - viewGroup: previousCompData.viewGroup - } + viewUrl: previousCompData.viewUrl, + isolateView: previousCompData.isolateView, + viewGroup: previousCompData.viewGroup + } : {} }) ); @@ -521,7 +521,7 @@ class RoutingClass { if (additionalModalPath) { const modalParams = RoutingHelpers.getModalParamsFromPath(); const { nodeObject } = await Navigation.extractDataFromPath(additionalModalPath); - LuigiNavigation.openAsModal(additionalModalPath, nodeObject.openNodeInModal || modalParams); + LuigiNavigation.openAsModal(additionalModalPath, modalParams || nodeObject.openNodeInModal); } } From 757d8cf607f74d521455881de262ba625e488f08 Mon Sep 17 00:00:00 2001 From: "Doberer, Johannes" Date: Fri, 1 Dec 2023 20:35:16 +0100 Subject: [PATCH 2/4] format --- core/src/services/routing.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/core/src/services/routing.js b/core/src/services/routing.js index e493af68ed..b152ac862e 100644 --- a/core/src/services/routing.js +++ b/core/src/services/routing.js @@ -159,8 +159,8 @@ class RoutingClass { return LuigiConfig.getConfigValue('routing.useHashRouting') ? window.location.hash.replace('#', '') // TODO: GenericHelpers.getPathWithoutHash(window.location.hash) fails in ContextSwitcher : window.location.search - ? GenericHelpers.trimLeadingSlash(window.location.pathname) + window.location.search - : GenericHelpers.trimLeadingSlash(window.location.pathname); + ? GenericHelpers.trimLeadingSlash(window.location.pathname) + window.location.search + : GenericHelpers.trimLeadingSlash(window.location.pathname); } /** @@ -204,7 +204,7 @@ class RoutingClass { this.resolveUnsavedChanges(path, component, iframeElement, config, newUrl); }, // user clicks no, do nothing, reject promise - () => { } + () => {} ); } @@ -443,10 +443,10 @@ class RoutingClass { Object.assign({}, newNodeData, { previousNodeValues: previousCompData ? { - viewUrl: previousCompData.viewUrl, - isolateView: previousCompData.isolateView, - viewGroup: previousCompData.viewGroup - } + viewUrl: previousCompData.viewUrl, + isolateView: previousCompData.isolateView, + viewGroup: previousCompData.viewGroup + } : {} }) ); From f92b13af4e214c42a5ce45f61c0339a98c4ea11f Mon Sep 17 00:00:00 2001 From: "Doberer, Johannes" Date: Fri, 1 Dec 2023 20:55:45 +0100 Subject: [PATCH 3/4] fix test --- core/test/services/routing.spec.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/core/test/services/routing.spec.js b/core/test/services/routing.spec.js index ebd5afc1de..82cc48ca90 100644 --- a/core/test/services/routing.spec.js +++ b/core/test/services/routing.spec.js @@ -9,7 +9,7 @@ const chai = require('chai'); const assert = chai.assert; const sinon = require('sinon'); -describe('Routing', function() { +describe('Routing', function () { jest.retryTimes(2); let component; @@ -776,7 +776,7 @@ describe('Routing', function() { it('should call console.warn when node has no children and there is no intention for empty viewUrl', async () => { // given const path = 'compound'; - const node = { compound: { renderer: () => {} } }; + const node = { compound: { renderer: () => { } } }; // when console.warn = sinon.spy(); @@ -794,7 +794,7 @@ describe('Routing', function() { it('should navigate to rootPath if node can be reached directly', async () => { // given const path = 'compound2'; - const node = { compound: { renderer: () => {} } }; + const node = { compound: { renderer: () => { } } }; // when component.viewUrl = path; @@ -812,7 +812,7 @@ describe('Routing', function() { it('should handle nodeObject that is compound', async () => { // given const path = 'compound3'; - const node = { compound: { renderer: () => {} } }; + const node = { compound: { renderer: () => { } } }; // when component.viewUrl = path; @@ -838,7 +838,7 @@ describe('Routing', function() { it('should handle nodeObject that is webcomponent', async () => { // given const path = 'compound-webcomponent'; - const node = { compound: { renderer: () => {} } }; + const node = { compound: { renderer: () => { } } }; // when component.viewUrl = path; @@ -1160,7 +1160,7 @@ describe('Routing', function() { describe('showPageNotFoundError()', () => { const component = { - showAlert: () => {} + showAlert: () => { } }; const pathToRedirect = '/go/here'; const pathToRedirect2 = '/go/there'; @@ -1259,7 +1259,7 @@ describe('Routing', function() { // then sinon.assert.calledWith(Navigation.extractDataFromPath, modalPath); sinon.assert.calledOnce(LuigiNavigation.openAsModal); - sinon.assert.calledWithExactly(LuigiNavigation.openAsModal, modalPath, mockNodeModalSettings.openNodeInModal); + sinon.assert.calledWithExactly(LuigiNavigation.openAsModal, modalPath, modalParams); }); }); describe('append and remove modal data from URL using path routing', () => { @@ -1626,7 +1626,7 @@ describe('Routing', function() { } }; }; - component.getUnsavedChangesModalPromise = () => {}; + component.getUnsavedChangesModalPromise = () => { }; sinon.stub(component, 'getUnsavedChangesModalPromise').resolves(); }); From 562db89bba3fc39c5bcd5e2ba645a38cd31bd83f Mon Sep 17 00:00:00 2001 From: "Doberer, Johannes" Date: Fri, 1 Dec 2023 20:56:12 +0100 Subject: [PATCH 4/4] format --- core/test/services/routing.spec.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/core/test/services/routing.spec.js b/core/test/services/routing.spec.js index 82cc48ca90..875f811972 100644 --- a/core/test/services/routing.spec.js +++ b/core/test/services/routing.spec.js @@ -9,7 +9,7 @@ const chai = require('chai'); const assert = chai.assert; const sinon = require('sinon'); -describe('Routing', function () { +describe('Routing', function() { jest.retryTimes(2); let component; @@ -776,7 +776,7 @@ describe('Routing', function () { it('should call console.warn when node has no children and there is no intention for empty viewUrl', async () => { // given const path = 'compound'; - const node = { compound: { renderer: () => { } } }; + const node = { compound: { renderer: () => {} } }; // when console.warn = sinon.spy(); @@ -794,7 +794,7 @@ describe('Routing', function () { it('should navigate to rootPath if node can be reached directly', async () => { // given const path = 'compound2'; - const node = { compound: { renderer: () => { } } }; + const node = { compound: { renderer: () => {} } }; // when component.viewUrl = path; @@ -812,7 +812,7 @@ describe('Routing', function () { it('should handle nodeObject that is compound', async () => { // given const path = 'compound3'; - const node = { compound: { renderer: () => { } } }; + const node = { compound: { renderer: () => {} } }; // when component.viewUrl = path; @@ -838,7 +838,7 @@ describe('Routing', function () { it('should handle nodeObject that is webcomponent', async () => { // given const path = 'compound-webcomponent'; - const node = { compound: { renderer: () => { } } }; + const node = { compound: { renderer: () => {} } }; // when component.viewUrl = path; @@ -1160,7 +1160,7 @@ describe('Routing', function () { describe('showPageNotFoundError()', () => { const component = { - showAlert: () => { } + showAlert: () => {} }; const pathToRedirect = '/go/here'; const pathToRedirect2 = '/go/there'; @@ -1626,7 +1626,7 @@ describe('Routing', function () { } }; }; - component.getUnsavedChangesModalPromise = () => { }; + component.getUnsavedChangesModalPromise = () => {}; sinon.stub(component, 'getUnsavedChangesModalPromise').resolves(); });