diff --git a/core/src/Modal.svelte b/core/src/Modal.svelte index af29c2d035..be28a0487c 100644 --- a/core/src/Modal.svelte +++ b/core/src/Modal.svelte @@ -321,18 +321,20 @@ {/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..deacd118da --- /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,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'); + }); + }); +});