mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-22 00:40:22 +02:00
fix: mocked SVG element
This commit is contained in:
@@ -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
|
// 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
|
// Real implementation returns an HTML Element
|
||||||
public node = vi.fn().mockImplementation(() => {
|
public node = vi.fn().mockImplementation(() => {
|
||||||
|
//create a top level svg element
|
||||||
const topElem = this._containingHTMLdoc.createElement('svg');
|
const topElem = this._containingHTMLdoc.createElement('svg');
|
||||||
|
//@ts-ignore - this is a mock SVG element
|
||||||
topElem.getBBox = this.getBBox;
|
topElem.getBBox = this.getBBox;
|
||||||
const elem_svgChild = this._containingHTMLdoc.createElement('svg'); // another svg element
|
const elem_svgChild = this._containingHTMLdoc.createElement('svg'); // another svg element
|
||||||
topElem.appendChild(elem_svgChild);
|
topElem.appendChild(elem_svgChild);
|
||||||
|
Reference in New Issue
Block a user