Skip to content

Commit

Permalink
fix(mock-doc): return empty string if anchor has no href attribute (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
christian-bromann authored Nov 21, 2024
1 parent 8f1bc55 commit e44642f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/mock-doc/element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ export class MockAnchorElement extends MockHTMLElement {
this.setAttribute('href', value);
}
get pathname() {
if (!this.href) {
return '';
}
return new URL(this.href).pathname;
}
}
Expand Down

0 comments on commit e44642f

Please sign in to comment.