Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@
"@babel/polyfill": "7.12.1",
"@cypress/snapshot": "^2.1.7",
"@date-fns/tz": "1.4.1",
"@digdir/designsystemet-css": "1.9.0",
"@digdir/designsystemet-react": "1.9.0",
"@digdir/designsystemet-theme": "1.9.0",
"@digdir/designsystemet-css": "1.11.1",
"@digdir/designsystemet-react": "1.11.1",
"@digdir/designsystemet-theme": "1.11.0",
"@navikt/aksel-icons": "7.38.0",
"@tanstack/react-query": "5.90.16",
"@types/cypress": "^1.1.6",
Expand Down
2 changes: 1 addition & 1 deletion snapshots.js
Original file line number Diff line number Diff line change
Expand Up @@ -368,5 +368,5 @@ module.exports = {
}
}
},
"__version": "15.7.0"
"__version": "15.8.2"
}
80 changes: 40 additions & 40 deletions test/e2e/integration/component-library/multiple-select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,21 @@ describe('Multiple select component', () => {
cy.get(multiselect).click();

cy.get(multiselectList).contains('span', checkboxText1).click();
cy.findByRole('button', { name: /Karoline, Press to remove, 1 of 1/i }).should('exist');
cy.findByRole('option', { name: /Karoline, Press to remove/i }).should('exist');
cy.get(multiselectList).contains('span', checkboxText2).click();
cy.findByRole('button', { name: /Kåre, Press to remove, 2 of 2/i }).should('exist');
cy.findByRole('option', { name: /Kåre, Press to remove/i }).should('exist');
cy.get(multiselectList).contains('span', checkboxText3).click();
cy.findByRole('button', { name: /Johanne, Press to remove, 3 of 3/i }).should('exist');
cy.findByRole('option', { name: /Johanne, Press to remove/i }).should('exist');
cy.get(multiselectList).contains('span', checkboxText4).click();
cy.findByRole('button', { name: /Kari, Press to remove, 4 of 4/i }).should('exist');
cy.findByRole('option', { name: /Kari, Press to remove/i }).should('exist');
cy.get(multiselectList).contains('span', checkboxText5).click();
cy.findByRole('button', { name: /Petter, Press to remove, 5 of 5/i }).should('exist');
cy.findByRole('option', { name: /Petter, Press to remove/i }).should('exist');

//Uncheck
cy.get(multiselectList).contains('span', checkboxText4).click();
cy.findByRole('button', { name: /^Kari/i }).should('not.exist');
cy.findByRole('option', { name: /Kari, Press to remove/i }).should('not.exist');
cy.get(multiselectList).contains('span', checkboxText5).click();
cy.findByRole('button', { name: /^Petter/i }).should('not.exist');
cy.findByRole('option', { name: /Petter, Press to remove/i }).should('not.exist');

// Close the multiple select component
cy.get(multiselect).type('{esc}');
Expand All @@ -53,11 +53,11 @@ describe('Multiple select component', () => {
.findAllByRole('button', { name: /^Slett/ })
.first()
.click();
cy.findByRole('button', { name: /^Karoline/i }).should('not.exist');
cy.findByRole('option', { name: /^Karoline/i }).should('not.exist');

// Unchecking from Checkboxes should remove from RepeatingGroup (observe that data is preserved)
cy.get(multiselect).type('{esc}'); // Make sure the multiselect is closed
cy.findByRole('button', { name: /Kåre, Press to remove, 1 of 2/i }).should('exist');
cy.findByRole('option', { name: /Kåre, Press to remove/i }).should('exist');
cy.get(repGroup).findAllByRole('row').should('have.length', 3); // Header + 2 row
cy.get(repGroup)
.findAllByRole('button', { name: /^Rediger/ })
Expand Down Expand Up @@ -92,20 +92,20 @@ describe('Multiple select component', () => {
cy.findByRole('option', { name: /Kjøring i skogen/i }).click();
cy.findByRole('option', { name: /Kjøre til hytta på fjellet/i }).click();

cy.findByRole('button', {
name: /Korte strekninger med bykjøring, eller annen moro, Press to remove, 1 of 3/i,
cy.findByRole('option', {
name: /Korte strekninger med bykjøring, eller annen moro, Press to remove/i,
}).should('exist');
cy.findByRole('button', { name: /Kjøring i skogen, Press to remove, 2 of 3/i }).should('exist');
cy.findByRole('button', { name: /Kjøre til hytta på fjellet, Press to remove, 3 of 3/i }).should('exist');
cy.findByRole('option', { name: /Kjøring i skogen, Press to remove/i }).should('exist');
cy.findByRole('option', { name: /Kjøre til hytta på fjellet, Press to remove/i }).should('exist');

// The clickable element is a psuedo-element within the button
cy.findByRole('button', { name: /Kjøring i skogen, Press to remove, 2 of 3/i }).click('right', { force: true });
cy.findByRole('option', { name: /Kjøring i skogen, Press to remove/i }).click('right', { force: true });
cy.findByRole('button', { name: /Bekreft/i }).click();

cy.findByRole('button', {
name: /Korte strekninger med bykjøring, eller annen moro, Press to remove, 1 of 2/i,
cy.findByRole('option', {
name: /Korte strekninger med bykjøring, eller annen moro, Press to remove/i,
}).should('exist');
cy.findByRole('button', { name: /Kjøre til hytta på fjellet, Press to remove, 2 of 2/i }).should('exist');
cy.findByRole('option', { name: /Kjøre til hytta på fjellet, Press to remove/i }).should('exist');
});

it('Adds and removes data properly when using group and hard deletion', () => {
Expand All @@ -122,21 +122,21 @@ describe('Multiple select component', () => {

// Check options in multiple select component
cy.get(multiselectList).contains('span', checkboxText1).click();
cy.findByRole('button', { name: /Karoline, Press to remove, 1 of 1/i }).should('exist');
cy.findByRole('option', { name: /Karoline, Press to remove/i }).should('exist');
cy.get(multiselectList).contains('span', checkboxText2).click();
cy.findByRole('button', { name: /Kåre, Press to remove, 2 of 2/i }).should('exist');
cy.findByRole('option', { name: /Kåre, Press to remove/i }).should('exist');
cy.get(multiselectList).contains('span', checkboxText3).click();
cy.findByRole('button', { name: /Johanne, Press to remove, 3 of 3/i }).should('exist');
cy.findByRole('option', { name: /Johanne, Press to remove/i }).should('exist');
cy.get(multiselectList).contains('span', checkboxText4).click();
cy.findByRole('button', { name: /Kari, Press to remove, 4 of 4/i }).should('exist');
cy.findByRole('option', { name: /Kari, Press to remove/i }).should('exist');
cy.get(multiselectList).contains('span', checkboxText5).click();
cy.findByRole('button', { name: /Petter, Press to remove, 5 of 5/i }).should('exist');
cy.findByRole('option', { name: /Petter, Press to remove/i }).should('exist');

//Uncheck
cy.get(multiselectList).contains('span', checkboxText4).click();
cy.findByRole('button', { name: /^Kari/i }).should('not.exist');
cy.findByRole('option', { name: /Kari, Press to remove/i }).should('not.exist');
cy.get(multiselectList).contains('span', checkboxText5).click();
cy.findByRole('button', { name: /^Petter/i }).should('not.exist');
cy.findByRole('option', { name: /Petter, Press to remove/i }).should('not.exist');

// Close the multiple select component
cy.get(multiselect).type('{esc}');
Expand All @@ -154,8 +154,8 @@ describe('Multiple select component', () => {
.findAllByRole('button', { name: /^Slett/ })
.first()
.click();
cy.findByRole('button', {
name: /Karoline, Press to remove, 1 of 3/i,
cy.findByRole('option', {
name: /Karoline, Press to remove/i,
}).should('not.exist');

// Unchecking from multiple select should remove from RepeatingGroup (observe that data is preserved)
Expand Down Expand Up @@ -208,21 +208,21 @@ describe('Multiple select component', () => {

// Check options in multiple select component
cy.get(multiselectList).contains('span', checkboxText1).click();
cy.findByRole('button', { name: /Karoline, Press to remove, 1 of 1/i }).should('exist');
cy.findByRole('option', { name: /Karoline, Press to remove/i }).should('exist');
cy.get(multiselectList).contains('span', checkboxText2).click();
cy.findByRole('button', { name: /Kåre, Press to remove, 2 of 2/i }).should('exist');
cy.findByRole('option', { name: /Kåre, Press to remove/i }).should('exist');
cy.get(multiselectList).contains('span', checkboxText3).click();
cy.findByRole('button', { name: /Johanne, Press to remove, 3 of 3/i }).should('exist');
cy.findByRole('option', { name: /Johanne, Press to remove/i }).should('exist');
cy.get(multiselectList).contains('span', checkboxText4).click();
cy.findByRole('button', { name: /Kari, Press to remove, 4 of 4/i }).should('exist');
cy.findByRole('option', { name: /Kari, Press to remove/i }).should('exist');
cy.get(multiselectList).contains('span', checkboxText5).click();
cy.findByRole('button', { name: /Petter, Press to remove, 5 of 5/i }).should('exist');
cy.findByRole('option', { name: /Petter, Press to remove/i }).should('exist');

//Uncheck
cy.get(multiselectList).contains('span', checkboxText4).click();
cy.findByRole('button', { name: /^Kari/i }).should('not.exist');
cy.findByRole('option', { name: /Kari, Press to remove/i }).should('not.exist');
cy.get(multiselectList).contains('span', checkboxText5).click();
cy.findByRole('button', { name: /^Petter/i }).should('not.exist');
cy.findByRole('option', { name: /Petter, Press to remove/i }).should('not.exist');

// Close the multiple select component
cy.get(multiselect).type('{esc}');
Expand All @@ -248,21 +248,21 @@ describe('Multiple select component', () => {

// Check options in multiple select component
cy.get(multiselectList).contains('span', checkboxText1).click();
cy.findByRole('button', { name: /Karoline, Press to remove, 1 of 1/i }).should('exist');
cy.findByRole('option', { name: /Karoline, Press to remove/i }).should('exist');
cy.get(multiselectList).contains('span', checkboxText2).click();
cy.findByRole('button', { name: /Kåre, Press to remove, 2 of 2/i }).should('exist');
cy.findByRole('option', { name: /Kåre, Press to remove/i }).should('exist');
cy.get(multiselectList).contains('span', checkboxText3).click();
cy.findByRole('button', { name: /Johanne, Press to remove, 3 of 3/i }).should('exist');
cy.findByRole('option', { name: /Johanne, Press to remove/i }).should('exist');
cy.get(multiselectList).contains('span', checkboxText4).click();
cy.findByRole('button', { name: /Kari, Press to remove, 4 of 4/i }).should('exist');
cy.findByRole('option', { name: /Kari, Press to remove/i }).should('exist');
cy.get(multiselectList).contains('span', checkboxText5).click();
cy.findByRole('button', { name: /Petter, Press to remove, 5 of 5/i }).should('exist');
cy.findByRole('option', { name: /Petter, Press to remove/i }).should('exist');

//Uncheck
cy.get(multiselectList).contains('span', checkboxText4).click();
cy.findByRole('button', { name: /^Kari/i }).should('not.exist');
cy.findByRole('option', { name: /Kari, Press to remove/i }).should('not.exist');
cy.get(multiselectList).contains('span', checkboxText5).click();
cy.findByRole('button', { name: /^Petter/i }).should('not.exist');
cy.findByRole('option', { name: /Petter, Press to remove/i }).should('not.exist');

// Close the multiple select component
cy.get(multiselect).type('{esc}');
Expand Down
16 changes: 8 additions & 8 deletions test/e2e/integration/frontend-test/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -488,22 +488,22 @@ describe('UI Components', () => {
cy.findByRole('option', { name: /gul/i }).click();
cy.findByRole('option', { name: /gul/i }).should('have.attr', 'aria-selected', 'true');

cy.findByRole('button', {
name: /Grønn, Press to remove, 3 of 4/i,
cy.findByRole('option', {
name: /Grønn, Press to remove/i,
}).click('right', { force: true });
cy.get(appFrontend.deleteWarningPopover).should('contain.text', 'Er du sikker på at du vil slette Grønn?');
cy.findByRole('button', { name: /Avbryt/ }).click();
cy.findByRole('button', {
name: /Grønn, Press to remove, 3 of 4/i,
cy.findByRole('option', {
name: /Grønn, Press to remove/i,
}).should('exist');

cy.findByRole('button', {
name: /Gul, Press to remove, 4 of 4/i,
cy.findByRole('option', {
name: /Gul, Press to remove/i,
}).click('right', { force: true });
cy.get(appFrontend.deleteWarningPopover).should('contain.text', 'Er du sikker på at du vil slette Gul?');
cy.findByRole('button', { name: /Bekreft/ }).click();
cy.findByRole('button', {
name: /Gul, Press to remove, 4 of 4/i,
cy.findByRole('option', {
name: /Gul, Press to remove/i,
}).should('not.exist');
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const groupCheckboxMultiSelectListAndVerify = (checkboxText = '', multiSe
cy.get(multiselect).click();
cy.get(multiselectList).contains('span', multiSelectText).click();
cy.get(multiselect).contains('span', multiSelectText).should('exist');
cy.findByRole('button', { name: new RegExp(`${multiSelectText}, Press to remove, 1 of 1`) }).should('exist');
cy.findByRole('option', { name: new RegExp(`${multiSelectText}, Press to remove`) }).should('exist');
cy.get(repGroup).click({ force: true });

cy.gotoNavPage('Liste (tabell)');
Expand Down
Loading
Loading