From bbbc29767db7eadd996ba5b409f987be897b6c0c Mon Sep 17 00:00:00 2001 From: Sandro Castillo Date: Thu, 4 Nov 2021 11:47:40 -0500 Subject: [PATCH] fix: TT-392 Exclude from reports tags in the Ticket column --- .../time-entries-table.component.spec.ts | 10 ++++++++-- .../time-entries-table/time-entries-table.component.ts | 4 +++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/app/modules/reports/components/time-entries-table/time-entries-table.component.spec.ts b/src/app/modules/reports/components/time-entries-table/time-entries-table.component.spec.ts index 5789a0044..9712a7544 100644 --- a/src/app/modules/reports/components/time-entries-table/time-entries-table.component.spec.ts +++ b/src/app/modules/reports/components/time-entries-table/time-entries-table.component.spec.ts @@ -120,15 +120,21 @@ describe('Reports Page', () => { it('The data should be displayed as a multiple of hour when column is equal to 3', () => { const column = 3; - expect(component.bodyExportOptions(durationTime, row, column, node)).toMatch(decimalValidator); }); it('The data should not be displayed as a multiple of hour when column is different of 3', () => { const column = 4; - expect(component.bodyExportOptions(durationTime, row, column, node)).toBe(durationTime); + expect(component.bodyExportOptions(durationTime, row, column, node)).toBe(durationTime.toString()); + }); + + it('The link Ticket must not contain the ticket URL enclosed with < > when export a file csv, excel or PDF', () => { + const entry = 'https://TT-392-uri'; + const column = 0; + expect(component.bodyExportOptions(entry, row, column, node)).toBe('https://TT-392-uri'); }); + afterEach(() => { fixture.destroy(); }); diff --git a/src/app/modules/reports/components/time-entries-table/time-entries-table.component.ts b/src/app/modules/reports/components/time-entries-table/time-entries-table.component.ts index e42a956a5..c58735a1f 100644 --- a/src/app/modules/reports/components/time-entries-table/time-entries-table.component.ts +++ b/src/app/modules/reports/components/time-entries-table/time-entries-table.component.ts @@ -99,7 +99,9 @@ export class TimeEntriesTableComponent implements OnInit, OnDestroy, AfterViewIn } bodyExportOptions(data, row, column, node){ + // NOSONAR + const dataFormated = data.toString().replace(/<((.|\n)*?)>/gi, ''); const durationColumnIndex = 3; - return column === durationColumnIndex ? moment.duration(data).asHours().toFixed(2) : data; + return column === durationColumnIndex ? moment.duration(dataFormated).asHours().toFixed(2) : dataFormated; } }