From 267bbd0a05c454082b2ffc3e007d99c03e58d41f Mon Sep 17 00:00:00 2001 From: andreaNeki Date: Wed, 2 Oct 2024 13:24:28 -0300 Subject: [PATCH 01/13] Accessibility in the statistics table - adding a dynamic label to the object column --- .../statistics-table.component.html | 6 ++--- .../statistics-table.component.ts | 27 +++++++++++++++++++ src/assets/i18n/en.json5 | 10 +++++++ src/assets/i18n/es.json5 | 15 +++++++++++ src/assets/i18n/pt-BR.json5 | 15 +++++++++++ 5 files changed, 70 insertions(+), 3 deletions(-) diff --git a/src/app/statistics-page/statistics-table/statistics-table.component.html b/src/app/statistics-page/statistics-table/statistics-table.component.html index efa9ce43d99..d6e78866fa7 100644 --- a/src/app/statistics-page/statistics-table/statistics-table.component.html +++ b/src/app/statistics-page/statistics-table/statistics-table.component.html @@ -10,7 +10,7 @@

- + {{ objectHeaderLabel }} @@ -20,9 +20,9 @@

- + {{ getLabel(point) | async }} - + {{ point.values[header] }} diff --git a/src/app/statistics-page/statistics-table/statistics-table.component.ts b/src/app/statistics-page/statistics-table/statistics-table.component.ts index cd717305681..c7712d2e9b5 100644 --- a/src/app/statistics-page/statistics-table/statistics-table.component.ts +++ b/src/app/statistics-page/statistics-table/statistics-table.component.ts @@ -58,6 +58,11 @@ export class StatisticsTableComponent implements OnInit { */ headers: string[]; + /** + * Object header label + */ + objectHeaderLabel: string; + constructor( protected dsoService: DSpaceObjectDataService, protected nameService: DSONameService, @@ -71,6 +76,7 @@ export class StatisticsTableComponent implements OnInit { if (this.hasData) { this.headers = Object.keys(this.report.points[0].values); } + this.objectHeaderLabel = this.getObjectHeaderLabel(this.report.reportType); } /** @@ -91,4 +97,25 @@ export class StatisticsTableComponent implements OnInit { return of(point.label); } } + + /** + * Defines a dynamic label for the object column + * @param reportType + */ + getObjectHeaderLabel(reportType: string): string { + switch (reportType) { + case 'TotalVisits': + return this.translateService.instant('statistics.table.header.TotalVisits'); + case 'TotalVisitsPerMonth': + return this.translateService.instant('statistics.table.header.TotalVisitsPerMonth'); + case 'TotalDownloads': + return this.translateService.instant('statistics.table.header.TotalDownloads'); + case 'TopCities': + return this.translateService.instant('statistics.table.header.TopCities'); + case 'topCountries': + return this.translateService.instant('statistics.table.header.topCountries'); + default: + return ''; + } + } } diff --git a/src/assets/i18n/en.json5 b/src/assets/i18n/en.json5 index 31e45d46246..75368e8e839 100644 --- a/src/assets/i18n/en.json5 +++ b/src/assets/i18n/en.json5 @@ -6741,4 +6741,14 @@ "item.page.cc.license.disclaimer": "Except where otherwised noted, this item's license is described as", "browse.search-form.placeholder": "Search the repository", + + "statistics.table.header.TotalVisits": "Object", + + "statistics.table.header.TotalVisitsMonth": "Month", + + "statistics.table.header.TotalDownloads": "Downloads", + + "statistics.table.header.TopCities": "Cities", + + "statistics.table.header.topCountries": "Countries", } diff --git a/src/assets/i18n/es.json5 b/src/assets/i18n/es.json5 index 55962d25b5f..6c2863e9aeb 100644 --- a/src/assets/i18n/es.json5 +++ b/src/assets/i18n/es.json5 @@ -8152,5 +8152,20 @@ //"browse.search-form.placeholder": "Search the repository", "browse.search-form.placeholder": "Buscar en el repositorio", + // "statistics.table.header.TotalVisits": "Object", + "statistics.table.header.TotalVisits": "Objeto", + + // "statistics.table.header.TotalVisitsMonth": "Month", + "statistics.table.header.TotalVisitsMonth": "Mes", + + // "statistics.table.header.TotalDownloads": "Downloads", + "statistics.table.header.TotalDownloads": "Descargas", + + // "statistics.table.header.TopCities": "Cities", + "statistics.table.header.TopCities": "Ciudades", + + // "statistics.table.header.topCountries": "Countries", + "statistics.table.header.topCountries": "Países", + } diff --git a/src/assets/i18n/pt-BR.json5 b/src/assets/i18n/pt-BR.json5 index c3b26a09d28..24c329ed36d 100644 --- a/src/assets/i18n/pt-BR.json5 +++ b/src/assets/i18n/pt-BR.json5 @@ -10249,4 +10249,19 @@ //"browse.search-form.placeholder": "Search the repository", "browse.search-form.placeholder": "Buscar no repositório", + + // "statistics.table.header.TotalVisits": "Object", + "statistics.table.header.TotalVisits": "Objeto", + + // "statistics.table.header.TotalVisitsMonth": "Month", + "statistics.table.header.TotalVisitsMonth": "Mês", + + // "statistics.table.header.TotalDownloads": "Downloads", + "statistics.table.header.TotalDownloads": "Downloads", + + // "statistics.table.header.TopCities": "Cities", + "statistics.table.header.TopCities": "Cidades", + + // "statistics.table.header.topCountries": "Countries", + "statistics.table.header.topCountries": "Países", } From 567dffae3340ae66a428b8cbb0e9c94c76900939 Mon Sep 17 00:00:00 2001 From: andreaNeki Date: Thu, 3 Oct 2024 10:31:57 -0300 Subject: [PATCH 02/13] back to the tags that were being used at first --- .../statistics-table/statistics-table.component.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/statistics-page/statistics-table/statistics-table.component.html b/src/app/statistics-page/statistics-table/statistics-table.component.html index d6e78866fa7..6e744b281f4 100644 --- a/src/app/statistics-page/statistics-table/statistics-table.component.html +++ b/src/app/statistics-page/statistics-table/statistics-table.component.html @@ -10,7 +10,7 @@

- {{ objectHeaderLabel }} + {{ objectHeaderLabel }} @@ -20,9 +20,9 @@

- + {{ getLabel(point) | async }} - + {{ point.values[header] }} From 6e47be7d7d2514a33d0422d87542e983bb89c1ad Mon Sep 17 00:00:00 2001 From: andreaNeki Date: Thu, 3 Oct 2024 11:23:16 -0300 Subject: [PATCH 03/13] New attempt -back to the tags that were being used at first --- .../statistics-table/statistics-table.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/statistics-page/statistics-table/statistics-table.component.html b/src/app/statistics-page/statistics-table/statistics-table.component.html index 6e744b281f4..6228b71e99f 100644 --- a/src/app/statistics-page/statistics-table/statistics-table.component.html +++ b/src/app/statistics-page/statistics-table/statistics-table.component.html @@ -10,7 +10,7 @@

- {{ objectHeaderLabel }} + {{ objectHeaderLabel }} From 389d38d76b81407960abcff40c2f941b608aa4fc Mon Sep 17 00:00:00 2001 From: andreaNeki Date: Tue, 22 Oct 2024 17:10:29 -0300 Subject: [PATCH 04/13] Configuring e2e statistics tests to accept the td tag and adding tests for the getObjectHeaderLabel method --- cypress/e2e/collection-statistics.cy.ts | 2 +- cypress/e2e/community-statistics.cy.ts | 2 +- cypress/e2e/homepage-statistics.cy.ts | 2 +- cypress/e2e/item-statistics.cy.ts | 2 +- .../statistics-table.component.html | 6 ++--- .../statistics-table.component.spec.ts | 26 +++++++++++++++++++ 6 files changed, 33 insertions(+), 7 deletions(-) diff --git a/cypress/e2e/collection-statistics.cy.ts b/cypress/e2e/collection-statistics.cy.ts index 3e5a465e398..8679f1e3652 100644 --- a/cypress/e2e/collection-statistics.cy.ts +++ b/cypress/e2e/collection-statistics.cy.ts @@ -29,7 +29,7 @@ describe('Collection Statistics Page', () => { // Verify / wait until "Total Visits" table's label is non-empty // (This table loads these labels asynchronously, so we want to wait for them before analyzing page) - cy.get('table[data-test="TotalVisits"] th[data-test="statistics-label"]').contains(REGEX_MATCH_NON_EMPTY_TEXT); + cy.get('table[data-test="TotalVisits"] td[data-test="statistics-label"]').contains(REGEX_MATCH_NON_EMPTY_TEXT); // Analyze for accessibility issues testA11y('ds-collection-statistics-page'); diff --git a/cypress/e2e/community-statistics.cy.ts b/cypress/e2e/community-statistics.cy.ts index 00e23a90b37..b202b1e4502 100644 --- a/cypress/e2e/community-statistics.cy.ts +++ b/cypress/e2e/community-statistics.cy.ts @@ -29,7 +29,7 @@ describe('Community Statistics Page', () => { // Verify / wait until "Total Visits" table's label is non-empty // (This table loads these labels asynchronously, so we want to wait for them before analyzing page) - cy.get('table[data-test="TotalVisits"] th[data-test="statistics-label"]').contains(REGEX_MATCH_NON_EMPTY_TEXT); + cy.get('table[data-test="TotalVisits"] td[data-test="statistics-label"]').contains(REGEX_MATCH_NON_EMPTY_TEXT); // Analyze for accessibility issues testA11y('ds-community-statistics-page'); diff --git a/cypress/e2e/homepage-statistics.cy.ts b/cypress/e2e/homepage-statistics.cy.ts index 0e0fca3c5bb..7eb4635cdb9 100644 --- a/cypress/e2e/homepage-statistics.cy.ts +++ b/cypress/e2e/homepage-statistics.cy.ts @@ -22,7 +22,7 @@ describe('Site Statistics Page', () => { // Verify / wait until "Total Visits" table's *last* label is non-empty // (This table loads these labels asynchronously, so we want to wait for them before analyzing page) - cy.get('table[data-test="TotalVisits"] th[data-test="statistics-label"]').last().contains(REGEX_MATCH_NON_EMPTY_TEXT); + cy.get('table[data-test="TotalVisits"] td[data-test="statistics-label"]').last().contains(REGEX_MATCH_NON_EMPTY_TEXT); // Wait an extra 500ms, just so all entries in Total Visits have loaded. cy.wait(500); diff --git a/cypress/e2e/item-statistics.cy.ts b/cypress/e2e/item-statistics.cy.ts index 6518f595a90..aafe4bfc04c 100644 --- a/cypress/e2e/item-statistics.cy.ts +++ b/cypress/e2e/item-statistics.cy.ts @@ -35,7 +35,7 @@ describe('Item Statistics Page', () => { // Verify / wait until "Total Visits" table's label is non-empty // (This table loads these labels asynchronously, so we want to wait for them before analyzing page) - cy.get('table[data-test="TotalVisits"] th[data-test="statistics-label"]').contains(REGEX_MATCH_NON_EMPTY_TEXT); + cy.get('table[data-test="TotalVisits"] td[data-test="statistics-label"]').contains(REGEX_MATCH_NON_EMPTY_TEXT); // Analyze for accessibility issues testA11y('ds-item-statistics-page'); diff --git a/src/app/statistics-page/statistics-table/statistics-table.component.html b/src/app/statistics-page/statistics-table/statistics-table.component.html index 6228b71e99f..d6e78866fa7 100644 --- a/src/app/statistics-page/statistics-table/statistics-table.component.html +++ b/src/app/statistics-page/statistics-table/statistics-table.component.html @@ -10,7 +10,7 @@

- {{ objectHeaderLabel }} + {{ objectHeaderLabel }} @@ -20,9 +20,9 @@

- + {{ getLabel(point) | async }} - + {{ point.values[header] }} diff --git a/src/app/statistics-page/statistics-table/statistics-table.component.spec.ts b/src/app/statistics-page/statistics-table/statistics-table.component.spec.ts index 105a7623d6b..60fb0fdb007 100644 --- a/src/app/statistics-page/statistics-table/statistics-table.component.spec.ts +++ b/src/app/statistics-page/statistics-table/statistics-table.component.spec.ts @@ -97,4 +97,30 @@ describe('StatisticsTableComponent', () => { .toEqual('8'); }); }); + + describe('getObjectHeaderLabel', () => { + it('should return the correct label for TotalVisits', () => { + expect(component.getObjectHeaderLabel('TotalVisits')).toEqual('statistics.table.header.TotalVisits'); + }); + + it('should return the correct label for TotalVisitsPerMonth', () => { + expect(component.getObjectHeaderLabel('TotalVisitsPerMonth')).toEqual('statistics.table.header.TotalVisitsPerMonth'); + }); + + it('should return the correct label for TotalDownloads', () => { + expect(component.getObjectHeaderLabel('TotalDownloads')).toEqual('statistics.table.header.TotalDownloads'); + }); + + it('should return the correct label for TopCities', () => { + expect(component.getObjectHeaderLabel('TopCities')).toEqual('statistics.table.header.TopCities'); + }); + + it('should return the correct label for topCountries', () => { + expect(component.getObjectHeaderLabel('topCountries')).toEqual('statistics.table.header.topCountries'); + }); + + it('should return an empty string for unknown report types', () => { + expect(component.getObjectHeaderLabel('UnknownType')).toEqual(''); + }); + }); }); From cc7b2726057d4dd413a76f5cb067073eed1a29c1 Mon Sep 17 00:00:00 2001 From: andreaNeki Date: Wed, 23 Oct 2024 09:22:29 -0300 Subject: [PATCH 05/13] Trying to solve the final spaces not allowed error --- .../statistics-table/statistics-table.component.spec.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/app/statistics-page/statistics-table/statistics-table.component.spec.ts b/src/app/statistics-page/statistics-table/statistics-table.component.spec.ts index 60fb0fdb007..15c203ff8ed 100644 --- a/src/app/statistics-page/statistics-table/statistics-table.component.spec.ts +++ b/src/app/statistics-page/statistics-table/statistics-table.component.spec.ts @@ -97,8 +97,9 @@ describe('StatisticsTableComponent', () => { .toEqual('8'); }); }); - + describe('getObjectHeaderLabel', () => { + it('should return the correct label for TotalVisits', () => { expect(component.getObjectHeaderLabel('TotalVisits')).toEqual('statistics.table.header.TotalVisits'); }); From 8b9d0e600e4eb8b42e616551c15290f8f7f7c166 Mon Sep 17 00:00:00 2001 From: andreaNeki Date: Wed, 23 Oct 2024 09:30:03 -0300 Subject: [PATCH 06/13] Trying to solve the final spaces not allowed error --- .../statistics-table/statistics-table.component.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/statistics-page/statistics-table/statistics-table.component.spec.ts b/src/app/statistics-page/statistics-table/statistics-table.component.spec.ts index 15c203ff8ed..9d2df8d050c 100644 --- a/src/app/statistics-page/statistics-table/statistics-table.component.spec.ts +++ b/src/app/statistics-page/statistics-table/statistics-table.component.spec.ts @@ -99,7 +99,7 @@ describe('StatisticsTableComponent', () => { }); describe('getObjectHeaderLabel', () => { - + it('should return the correct label for TotalVisits', () => { expect(component.getObjectHeaderLabel('TotalVisits')).toEqual('statistics.table.header.TotalVisits'); }); From 9efa90fee5ba520e7cabac0e18c5e019a017b12c Mon Sep 17 00:00:00 2001 From: andreaNeki Date: Wed, 23 Oct 2024 10:27:15 -0300 Subject: [PATCH 07/13] Checking the collection-statistics.cy.ts test --- cypress/e2e/collection-statistics.cy.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress/e2e/collection-statistics.cy.ts b/cypress/e2e/collection-statistics.cy.ts index 8679f1e3652..4712f60dc12 100644 --- a/cypress/e2e/collection-statistics.cy.ts +++ b/cypress/e2e/collection-statistics.cy.ts @@ -29,7 +29,7 @@ describe('Collection Statistics Page', () => { // Verify / wait until "Total Visits" table's label is non-empty // (This table loads these labels asynchronously, so we want to wait for them before analyzing page) - cy.get('table[data-test="TotalVisits"] td[data-test="statistics-label"]').contains(REGEX_MATCH_NON_EMPTY_TEXT); + cy.get('table[data-test="TotalVisits"] td[data-test="statistics-label"]').should('have.length.greaterThan', 0).contains(REGEX_MATCH_NON_EMPTY_TEXT); // Analyze for accessibility issues testA11y('ds-collection-statistics-page'); From 941cb99777a2de57c062613f8278eb231cedfa18 Mon Sep 17 00:00:00 2001 From: andreaNeki Date: Wed, 23 Oct 2024 13:43:15 -0300 Subject: [PATCH 08/13] Back to the data-test statistics-label settings --- cypress/e2e/collection-statistics.cy.ts | 2 +- cypress/e2e/community-statistics.cy.ts | 2 +- cypress/e2e/homepage-statistics.cy.ts | 2 +- .../statistics-table/statistics-table.component.html | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cypress/e2e/collection-statistics.cy.ts b/cypress/e2e/collection-statistics.cy.ts index 4712f60dc12..3e5a465e398 100644 --- a/cypress/e2e/collection-statistics.cy.ts +++ b/cypress/e2e/collection-statistics.cy.ts @@ -29,7 +29,7 @@ describe('Collection Statistics Page', () => { // Verify / wait until "Total Visits" table's label is non-empty // (This table loads these labels asynchronously, so we want to wait for them before analyzing page) - cy.get('table[data-test="TotalVisits"] td[data-test="statistics-label"]').should('have.length.greaterThan', 0).contains(REGEX_MATCH_NON_EMPTY_TEXT); + cy.get('table[data-test="TotalVisits"] th[data-test="statistics-label"]').contains(REGEX_MATCH_NON_EMPTY_TEXT); // Analyze for accessibility issues testA11y('ds-collection-statistics-page'); diff --git a/cypress/e2e/community-statistics.cy.ts b/cypress/e2e/community-statistics.cy.ts index b202b1e4502..00e23a90b37 100644 --- a/cypress/e2e/community-statistics.cy.ts +++ b/cypress/e2e/community-statistics.cy.ts @@ -29,7 +29,7 @@ describe('Community Statistics Page', () => { // Verify / wait until "Total Visits" table's label is non-empty // (This table loads these labels asynchronously, so we want to wait for them before analyzing page) - cy.get('table[data-test="TotalVisits"] td[data-test="statistics-label"]').contains(REGEX_MATCH_NON_EMPTY_TEXT); + cy.get('table[data-test="TotalVisits"] th[data-test="statistics-label"]').contains(REGEX_MATCH_NON_EMPTY_TEXT); // Analyze for accessibility issues testA11y('ds-community-statistics-page'); diff --git a/cypress/e2e/homepage-statistics.cy.ts b/cypress/e2e/homepage-statistics.cy.ts index 7eb4635cdb9..0e0fca3c5bb 100644 --- a/cypress/e2e/homepage-statistics.cy.ts +++ b/cypress/e2e/homepage-statistics.cy.ts @@ -22,7 +22,7 @@ describe('Site Statistics Page', () => { // Verify / wait until "Total Visits" table's *last* label is non-empty // (This table loads these labels asynchronously, so we want to wait for them before analyzing page) - cy.get('table[data-test="TotalVisits"] td[data-test="statistics-label"]').last().contains(REGEX_MATCH_NON_EMPTY_TEXT); + cy.get('table[data-test="TotalVisits"] th[data-test="statistics-label"]').last().contains(REGEX_MATCH_NON_EMPTY_TEXT); // Wait an extra 500ms, just so all entries in Total Visits have loaded. cy.wait(500); diff --git a/src/app/statistics-page/statistics-table/statistics-table.component.html b/src/app/statistics-page/statistics-table/statistics-table.component.html index d6e78866fa7..9ea8ab2d03b 100644 --- a/src/app/statistics-page/statistics-table/statistics-table.component.html +++ b/src/app/statistics-page/statistics-table/statistics-table.component.html @@ -20,9 +20,9 @@

- + {{ getLabel(point) | async }} - + {{ point.values[header] }} From 8633d77ac2dc59084075f7035a441aa06876c16d Mon Sep 17 00:00:00 2001 From: andreaNeki Date: Wed, 23 Oct 2024 14:42:25 -0300 Subject: [PATCH 09/13] adjusting the file item-statistics.cy.ts --- cypress/e2e/item-statistics.cy.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress/e2e/item-statistics.cy.ts b/cypress/e2e/item-statistics.cy.ts index aafe4bfc04c..6518f595a90 100644 --- a/cypress/e2e/item-statistics.cy.ts +++ b/cypress/e2e/item-statistics.cy.ts @@ -35,7 +35,7 @@ describe('Item Statistics Page', () => { // Verify / wait until "Total Visits" table's label is non-empty // (This table loads these labels asynchronously, so we want to wait for them before analyzing page) - cy.get('table[data-test="TotalVisits"] td[data-test="statistics-label"]').contains(REGEX_MATCH_NON_EMPTY_TEXT); + cy.get('table[data-test="TotalVisits"] th[data-test="statistics-label"]').contains(REGEX_MATCH_NON_EMPTY_TEXT); // Analyze for accessibility issues testA11y('ds-item-statistics-page'); From 6bb1c50eee8948fc8695b838fbfe606bb7ec12a8 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 17 Dec 2024 11:20:20 -0300 Subject: [PATCH 10/13] Removing unauthorized spaces --- src/assets/i18n/es.json5 | 2 +- src/assets/i18n/pt-BR.json5 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/assets/i18n/es.json5 b/src/assets/i18n/es.json5 index dbd79cabdb5..2a726260ab4 100644 --- a/src/assets/i18n/es.json5 +++ b/src/assets/i18n/es.json5 @@ -8133,7 +8133,7 @@ //"browse.search-form.placeholder": "Search the repository", "browse.search-form.placeholder": "Buscar en el repositorio", - + // "register-page.registration.aria.label": "Enter your e-mail address", "register-page.registration.aria.label": "Introduzca su dirección de correo electrónico", diff --git a/src/assets/i18n/pt-BR.json5 b/src/assets/i18n/pt-BR.json5 index 47abc53f276..812f5907c84 100644 --- a/src/assets/i18n/pt-BR.json5 +++ b/src/assets/i18n/pt-BR.json5 @@ -10231,7 +10231,7 @@ //"browse.search-form.placeholder": "Search the repository", "browse.search-form.placeholder": "Buscar no repositório", - + // "register-page.registration.aria.label": "Enter your e-mail address", "register-page.registration.aria.label": "Digite seu e-mail", From 796e0fcdc372d50416b4bc30447a237359205aa9 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 17 Dec 2024 11:26:10 -0300 Subject: [PATCH 11/13] Removing unauthorized spaces --- src/assets/i18n/en.json5 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/assets/i18n/en.json5 b/src/assets/i18n/en.json5 index 9e4a8f056bd..de2ff816f2e 100644 --- a/src/assets/i18n/en.json5 +++ b/src/assets/i18n/en.json5 @@ -6735,7 +6735,7 @@ "item.page.cc.license.disclaimer": "Except where otherwised noted, this item's license is described as", "browse.search-form.placeholder": "Search the repository", - + "register-page.registration.aria.label": "Enter your e-mail address", "forgot-email.form.aria.label": "Enter your e-mail address", From 098760779f997a37d2dc05d215029156d8c41dd6 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 30 Jan 2025 12:47:48 -0300 Subject: [PATCH 12/13] Code refactoring --- .../statistics-table.component.ts | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/src/app/statistics-page/statistics-table/statistics-table.component.ts b/src/app/statistics-page/statistics-table/statistics-table.component.ts index c7712d2e9b5..c5c5456f6d0 100644 --- a/src/app/statistics-page/statistics-table/statistics-table.component.ts +++ b/src/app/statistics-page/statistics-table/statistics-table.component.ts @@ -103,19 +103,6 @@ export class StatisticsTableComponent implements OnInit { * @param reportType */ getObjectHeaderLabel(reportType: string): string { - switch (reportType) { - case 'TotalVisits': - return this.translateService.instant('statistics.table.header.TotalVisits'); - case 'TotalVisitsPerMonth': - return this.translateService.instant('statistics.table.header.TotalVisitsPerMonth'); - case 'TotalDownloads': - return this.translateService.instant('statistics.table.header.TotalDownloads'); - case 'TopCities': - return this.translateService.instant('statistics.table.header.TopCities'); - case 'topCountries': - return this.translateService.instant('statistics.table.header.topCountries'); - default: - return ''; - } + return this.translateService.instant('statistics.table.header.' + reportType); } } From 6c0a5a9601756de809e4b3127860bb474e8b54c3 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 30 Jan 2025 14:49:28 -0300 Subject: [PATCH 13/13] Removing tests that are no longer needed --- .../statistics-table.component.spec.ts | 27 ------------------- 1 file changed, 27 deletions(-) diff --git a/src/app/statistics-page/statistics-table/statistics-table.component.spec.ts b/src/app/statistics-page/statistics-table/statistics-table.component.spec.ts index 9d2df8d050c..105a7623d6b 100644 --- a/src/app/statistics-page/statistics-table/statistics-table.component.spec.ts +++ b/src/app/statistics-page/statistics-table/statistics-table.component.spec.ts @@ -97,31 +97,4 @@ describe('StatisticsTableComponent', () => { .toEqual('8'); }); }); - - describe('getObjectHeaderLabel', () => { - - it('should return the correct label for TotalVisits', () => { - expect(component.getObjectHeaderLabel('TotalVisits')).toEqual('statistics.table.header.TotalVisits'); - }); - - it('should return the correct label for TotalVisitsPerMonth', () => { - expect(component.getObjectHeaderLabel('TotalVisitsPerMonth')).toEqual('statistics.table.header.TotalVisitsPerMonth'); - }); - - it('should return the correct label for TotalDownloads', () => { - expect(component.getObjectHeaderLabel('TotalDownloads')).toEqual('statistics.table.header.TotalDownloads'); - }); - - it('should return the correct label for TopCities', () => { - expect(component.getObjectHeaderLabel('TopCities')).toEqual('statistics.table.header.TopCities'); - }); - - it('should return the correct label for topCountries', () => { - expect(component.getObjectHeaderLabel('topCountries')).toEqual('statistics.table.header.topCountries'); - }); - - it('should return an empty string for unknown report types', () => { - expect(component.getObjectHeaderLabel('UnknownType')).toEqual(''); - }); - }); });