From a817d6cd388b2e45d311b2946e0442a2fe5f8434 Mon Sep 17 00:00:00 2001 From: "Doberer, Johannes" Date: Mon, 9 Sep 2024 13:48:36 +0200 Subject: [PATCH 1/2] Hide x btn of a modal --- core/src/Modal.svelte | 2 + ...test-app-client-linkManager-features.cy.js | 45 +++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 test/e2e-test-application/cypress/e2e/tests/0-js-test-app/js-test-app-client-linkManager-features.cy.js diff --git a/core/src/Modal.svelte b/core/src/Modal.svelte index af29c2d035..0b4b63800d 100644 --- a/core/src/Modal.svelte +++ b/core/src/Modal.svelte @@ -321,6 +321,7 @@ {/if} + {#if settings.hideXBtn !== true}
+ {/if} {/if}
diff --git a/test/e2e-test-application/cypress/e2e/tests/0-js-test-app/js-test-app-client-linkManager-features.cy.js b/test/e2e-test-application/cypress/e2e/tests/0-js-test-app/js-test-app-client-linkManager-features.cy.js new file mode 100644 index 0000000000..0fbde7aa28 --- /dev/null +++ b/test/e2e-test-application/cypress/e2e/tests/0-js-test-app/js-test-app-client-linkManager-features.cy.js @@ -0,0 +1,45 @@ +import defaultLuigiConfig from '../../configs/default'; +describe('JS-TEST-APP', () => { + const localRetries = { + retries: { + runMode: 4, + openMode: 4 + } + }; + describe('Configure x btn for a modal' , () => { + let newConfig; + beforeEach(() => { + newConfig = structuredClone(defaultLuigiConfig); + newConfig.navigation.nodes[0].children.push({ + pathSegment: 'openNodeInModal', + label: 'Open Node in Modal', + viewUrl: '/examples/microfrontends/multipurpose.html', + openNodeInModal: { + title: 'Title for modal', + hideXBtn: true + } + }) + newConfig.tag = 'js-test-app-modal-test'; + }); + it('x-btn not visible', ()=>{ + cy.visitTestApp('/', newConfig); + cy.get('[configversion="js-test-app-modal-test"]'); + cy.get('.fd-navigation').contains('Open Node in Modal').click(); + cy.get('.lui-modal-mf .lui-modal-header').should('not.have.attr', 'aria-label','close'); + }); + it('x-btn visible, hideXBtn=false', ()=>{ + newConfig.navigation.nodes[0].children[2].openNodeInModal.hideXBtn=false; + cy.visitTestApp('/', newConfig); + cy.get('[configversion="js-test-app-modal-test"]'); + cy.get('.fd-navigation').contains('Open Node in Modal').click(); + cy.get('.lui-modal-mf [aria-label="close"]').should('have.attr', 'data-testid','lui-modal-index-0'); + }); + it('x-btn visible, hideXBtn not defined', ()=>{ + delete newConfig.navigation.nodes[0].children[2].openNodeInModal.hideXBtn; + cy.visitTestApp('/', newConfig); + cy.get('[configversion="js-test-app-modal-test"]'); + cy.get('.fd-navigation').contains('Open Node in Modal').click(); + cy.get('.lui-modal-mf [aria-label="close"]').should('have.attr', 'data-testid','lui-modal-index-0'); + }); + }); +}); \ No newline at end of file From f46b1e453e6063a80e7fd648c705c7c19ad3425a Mon Sep 17 00:00:00 2001 From: "Doberer, Johannes" Date: Mon, 9 Sep 2024 13:48:49 +0200 Subject: [PATCH 2/2] prettier --- core/src/Modal.svelte | 22 ++--- ...test-app-client-linkManager-features.cy.js | 90 ++++++++++--------- 2 files changed, 59 insertions(+), 53 deletions(-) diff --git a/core/src/Modal.svelte b/core/src/Modal.svelte index 0b4b63800d..be28a0487c 100644 --- a/core/src/Modal.svelte +++ b/core/src/Modal.svelte @@ -322,18 +322,18 @@
{#if settings.hideXBtn !== true} -
-
- +
+
+ +
-
{/if}
{/if} diff --git a/test/e2e-test-application/cypress/e2e/tests/0-js-test-app/js-test-app-client-linkManager-features.cy.js b/test/e2e-test-application/cypress/e2e/tests/0-js-test-app/js-test-app-client-linkManager-features.cy.js index 0fbde7aa28..deacd118da 100644 --- a/test/e2e-test-application/cypress/e2e/tests/0-js-test-app/js-test-app-client-linkManager-features.cy.js +++ b/test/e2e-test-application/cypress/e2e/tests/0-js-test-app/js-test-app-client-linkManager-features.cy.js @@ -1,45 +1,51 @@ import defaultLuigiConfig from '../../configs/default'; describe('JS-TEST-APP', () => { - const localRetries = { - retries: { - runMode: 4, - openMode: 4 - } - }; - describe('Configure x btn for a modal' , () => { - let newConfig; - beforeEach(() => { - newConfig = structuredClone(defaultLuigiConfig); - newConfig.navigation.nodes[0].children.push({ - pathSegment: 'openNodeInModal', - label: 'Open Node in Modal', - viewUrl: '/examples/microfrontends/multipurpose.html', - openNodeInModal: { - title: 'Title for modal', - hideXBtn: true - } - }) - newConfig.tag = 'js-test-app-modal-test'; - }); - it('x-btn not visible', ()=>{ - cy.visitTestApp('/', newConfig); - cy.get('[configversion="js-test-app-modal-test"]'); - cy.get('.fd-navigation').contains('Open Node in Modal').click(); - cy.get('.lui-modal-mf .lui-modal-header').should('not.have.attr', 'aria-label','close'); - }); - it('x-btn visible, hideXBtn=false', ()=>{ - newConfig.navigation.nodes[0].children[2].openNodeInModal.hideXBtn=false; - cy.visitTestApp('/', newConfig); - cy.get('[configversion="js-test-app-modal-test"]'); - cy.get('.fd-navigation').contains('Open Node in Modal').click(); - cy.get('.lui-modal-mf [aria-label="close"]').should('have.attr', 'data-testid','lui-modal-index-0'); - }); - it('x-btn visible, hideXBtn not defined', ()=>{ - delete newConfig.navigation.nodes[0].children[2].openNodeInModal.hideXBtn; - cy.visitTestApp('/', newConfig); - cy.get('[configversion="js-test-app-modal-test"]'); - cy.get('.fd-navigation').contains('Open Node in Modal').click(); - cy.get('.lui-modal-mf [aria-label="close"]').should('have.attr', 'data-testid','lui-modal-index-0'); - }); + const localRetries = { + retries: { + runMode: 4, + openMode: 4 + } + }; + describe('Configure x btn for a modal', () => { + let newConfig; + beforeEach(() => { + newConfig = structuredClone(defaultLuigiConfig); + newConfig.navigation.nodes[0].children.push({ + pathSegment: 'openNodeInModal', + label: 'Open Node in Modal', + viewUrl: '/examples/microfrontends/multipurpose.html', + openNodeInModal: { + title: 'Title for modal', + hideXBtn: true + } + }); + newConfig.tag = 'js-test-app-modal-test'; }); -}); \ No newline at end of file + it('x-btn not visible', () => { + cy.visitTestApp('/', newConfig); + cy.get('[configversion="js-test-app-modal-test"]'); + cy.get('.fd-navigation') + .contains('Open Node in Modal') + .click(); + cy.get('.lui-modal-mf .lui-modal-header').should('not.have.attr', 'aria-label', 'close'); + }); + it('x-btn visible, hideXBtn=false', () => { + newConfig.navigation.nodes[0].children[2].openNodeInModal.hideXBtn = false; + cy.visitTestApp('/', newConfig); + cy.get('[configversion="js-test-app-modal-test"]'); + cy.get('.fd-navigation') + .contains('Open Node in Modal') + .click(); + cy.get('.lui-modal-mf [aria-label="close"]').should('have.attr', 'data-testid', 'lui-modal-index-0'); + }); + it('x-btn visible, hideXBtn not defined', () => { + delete newConfig.navigation.nodes[0].children[2].openNodeInModal.hideXBtn; + cy.visitTestApp('/', newConfig); + cy.get('[configversion="js-test-app-modal-test"]'); + cy.get('.fd-navigation') + .contains('Open Node in Modal') + .click(); + cy.get('.lui-modal-mf [aria-label="close"]').should('have.attr', 'data-testid', 'lui-modal-index-0'); + }); + }); +});