-
-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #812 from linghaoSu/task/811-svg-ownerSVGElement
#811@patch: Fix ownerSVGElement insteadof inifite loop.
- Loading branch information
Showing
2 changed files
with
35 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
packages/happy-dom/test/nodes/svg-element/SVGElement.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import Window from '../../../src/window/Window'; | ||
import Document from '../../../src/nodes/document/Document'; | ||
import SVGSVGElement from '../../../src/nodes/svg-element/SVGSVGElement'; | ||
import NamespaceURI from '../../../src/config/NamespaceURI'; | ||
import SVGElement from '../../../src/nodes/svg-element/SVGElement'; | ||
|
||
describe('SVGElement', () => { | ||
let window: Window; | ||
let document: Document; | ||
let element: SVGSVGElement; | ||
let line: SVGElement; | ||
|
||
beforeEach(() => { | ||
window = new Window(); | ||
document = window.document; | ||
element = <SVGSVGElement>document.createElementNS(NamespaceURI.svg, 'svg'); | ||
line = <SVGSVGElement>document.createElementNS(NamespaceURI.svg, 'line'); | ||
}); | ||
|
||
describe('get ownerSVGElement()', () => { | ||
it('Returns svg element when append to some svg.', () => { | ||
element.append(line); | ||
const ownerSVG = line.ownerSVGElement; | ||
expect(ownerSVG).toBe(element); | ||
}); | ||
|
||
it('Returns null when dangling.', () => { | ||
const ownerSVG = line.ownerSVGElement; | ||
expect(ownerSVG).toBe(null); | ||
}); | ||
}); | ||
}); |