Skip to content

Commit 1b369c1

Browse files
Copilotrenemadsen
andcommitted
Use Object.defineProperty for HTMLAnchorElement.click mock to ensure proper override
Co-authored-by: renemadsen <[email protected]>
1 parent f59c7a1 commit 1b369c1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

eform-client/src/app/plugins/modules/time-planning-pn/components/plannings/time-planning-actions/download-excel/download-excel-dialog.component.spec.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ describe('DownloadExcelDialogComponent', () => {
2222
global.URL.revokeObjectURL = jest.fn();
2323

2424
// Mock HTMLAnchorElement.prototype.click to prevent navigation errors
25-
HTMLAnchorElement.prototype.click = jest.fn();
25+
const mockClick = jest.fn();
26+
Object.defineProperty(HTMLAnchorElement.prototype, 'click', {
27+
configurable: true,
28+
value: mockClick,
29+
});
2630

2731
mockWorkingHoursService = {
2832
downloadReport: jest.fn(),

0 commit comments

Comments
 (0)