Skip to content

Commit

Permalink
add test for hash routing
Browse files Browse the repository at this point in the history
  • Loading branch information
maxmarkus committed Feb 17, 2021
1 parent 98ef642 commit 230b479
Showing 1 changed file with 26 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,32 @@ describe('Fiddle', () => {
cy.get('[data-testid="lui-us-header"]').should('not.be.visible');
});

it('Routing with showModalPathInUrl enabled and custom modalPathParam and node params', () => {
it('Hash routing with showModalPathInUrl enabled and custom modalPathParam and node params', () => {
newConfig.navigation.nodes[0].children[0].viewUrl =
'/examples/microfrontends/hello-luigi-cdn.html';
newConfig.routing.showModalPathInUrl = true;
newConfig.routing.modalPathParam = 'mymodal';
newConfig.routing.useHashRouting = true;

cy.visitWithFiddleConfig('/home', newConfig);

cy.window().then(win => {
win.Luigi.navigation()
.withParams({ mp: 'one' })
.openAsModal('/home/one');
});

cy.wait(150); // it takes some time for the nodeParams be available
cy.getModalWindow().then(win => {
assert.deepEqual(win.LuigiClient.getNodeParams(), { mp: 'one' });
});

cy.expectPathToBe(
'/home?mymodal=' + encodeURIComponent('/home/one?~mp=one')
);
});

it('Path routing with showModalPathInUrl enabled and custom modalPathParam and node params', () => {
newConfig.navigation.nodes[0].children[0].viewUrl =
'/examples/microfrontends/hello-luigi-cdn.html';
newConfig.routing.showModalPathInUrl = true;
Expand Down

0 comments on commit 230b479

Please sign in to comment.