From 4c6ee6e25a68625fe7b0941db28681a69f1ce44a Mon Sep 17 00:00:00 2001 From: Norbert Bartos Date: Tue, 13 Nov 2018 17:13:40 +0100 Subject: Add unit tests --- spec/spec/doc.js | 8 ++++++++ spec/spec/element.js | 5 +++++ 2 files changed, 13 insertions(+) (limited to 'spec') diff --git a/spec/spec/doc.js b/spec/spec/doc.js index bec6fb4..1b47717 100644 --- a/spec/spec/doc.js +++ b/spec/spec/doc.js @@ -63,4 +63,12 @@ describe('Doc', function() { }) }) + describe('parent()', function () { + it('returns null if nodeName is document-fragment', function() { + var fragment = document.createDocumentFragment(); + var svgFrag = new SVG(fragment); + expect(svgFrag.parent()).toBe(null); + }) + }) + }) diff --git a/spec/spec/element.js b/spec/spec/element.js index 8f82e3c..a5b3ba1 100644 --- a/spec/spec/element.js +++ b/spec/spec/element.js @@ -635,6 +635,11 @@ describe('Element', function() { var g = new SVG.G() expect(new SVG.Rect().addTo(g).parent()).toBe(g) }) + it('returns null if nodeName is document-fragment', function() { + var fragment = document.createDocumentFragment(); + var svgFrag = new SVG(fragment); + expect(svgFrag.parent()).toBe(null); + }) }) describe('parents()', function() { -- cgit v1.2.3