Skip to content
Merged
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
fix: TT-392 Exclude from reports tags </> in the Ticket column
  • Loading branch information
scastillo-jp committed Nov 4, 2021
commit f7d70234994a9237b7fbe154346459ada9d8eae9
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '<a _ngcontent-vlm-c151="" class="is-url">https://TT-392-uri</a>';
const column = 0;
expect(component.bodyExportOptions(entry, row, column, node)).toBe('https://TT-392-uri');
});


afterEach(() => {
fixture.destroy();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ export class TimeEntriesTableComponent implements OnInit, OnDestroy, AfterViewIn
}

bodyExportOptions(data, row, column, node){
const dataFormated = data.toString().replace(/<((.|\n){0,200}?)>/gi, '');
const durationColumnIndex = 3;
return column === durationColumnIndex ? moment.duration(data).asHours().toFixed(2) : data;
return column === durationColumnIndex ? moment.duration(dataFormated).asHours().toFixed(2) : dataFormated;
}
}