From 661c8b4fe3c57455ee5351732dba2a1cbc868d7b Mon Sep 17 00:00:00 2001 From: Angi-Kinas <133115263+Angi-Kinas@users.noreply.github.com> Date: Fri, 3 Nov 2023 13:58:06 +0100 Subject: [PATCH] feat(ME): Add count for selected records (#666) * feat(ME): Add selected records count, add translations * feat(ME): Add e2e tests for chekcboxes * feat(ME): Remove np from records table title --- .../src/e2e/dashboard.cy.ts | 34 +++++++++++++++++++ .../app/records/records-list.component.html | 1 - .../record-table/record-table.component.html | 28 ++++++++++----- translations/de.json | 1 + translations/en.json | 1 + translations/es.json | 1 + translations/fr.json | 1 + translations/it.json | 1 + translations/nl.json | 1 + translations/pt.json | 1 + 10 files changed, 60 insertions(+), 10 deletions(-) diff --git a/apps/metadata-editor-e2e/src/e2e/dashboard.cy.ts b/apps/metadata-editor-e2e/src/e2e/dashboard.cy.ts index 01fcd7a4ef..bb64524af4 100644 --- a/apps/metadata-editor-e2e/src/e2e/dashboard.cy.ts +++ b/apps/metadata-editor-e2e/src/e2e/dashboard.cy.ts @@ -61,4 +61,38 @@ describe('dashboard', () => { }) }) }) + + describe('checkboxes', () => { + it('should show the correct amount of selected records when they are selected', () => { + cy.visit('/records/all') + cy.get('gn-ui-record-table') + .find('.record-table-col') + .get('[type="checkbox"]') + .eq(2) + .click() + cy.get('.selected-records').contains('1 selected') + }) + + it('should show nothing when none are selected', () => { + cy.visit('/records/all') + cy.get('gn-ui-record-table') + .find('.record-table-col') + .get('mat-checkbox.mat-primary') + .each(($checkbox) => cy.wrap($checkbox).click()) + cy.get('.records-information').should( + 'not.have.descendants', + '.selected-records' + ) + }) + + it('should select all records when the "select all" checkbox is checked', () => { + cy.visit('/records/all') + cy.get('gn-ui-record-table') + .find('.record-table-col') + .get('mat-checkbox.mat-primary') + .first() + .click() + cy.get('.selected-records').contains('12 selected') + }) + }) }) diff --git a/apps/metadata-editor/src/app/records/records-list.component.html b/apps/metadata-editor/src/app/records/records-list.component.html index ef2f49181f..8bdb00e3c6 100644 --- a/apps/metadata-editor/src/app/records/records-list.component.html +++ b/apps/metadata-editor/src/app/records/records-list.component.html @@ -14,7 +14,6 @@