fix: mocked SVG element

This commit is contained in:
Ashish Jain
2024-07-15 15:16:27 +02:00
parent f9a20ab94e
commit d2a73bcef4

View File

@@ -104,7 +104,9 @@ export class MockedD3 {
// This allows different tests to succeed -- some need a top level 'svg' and some need a 'svg' element to be the firstChild
// Real implementation returns an HTML Element
public node = vi.fn().mockImplementation(() => {
//create a top level svg element
const topElem = this._containingHTMLdoc.createElement('svg');
//@ts-ignore - this is a mock SVG element
topElem.getBBox = this.getBBox;
const elem_svgChild = this._containingHTMLdoc.createElement('svg'); // another svg element
topElem.appendChild(elem_svgChild);