aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorNorbert Bartos <bartos.norbert@danubiusinfo.hu>2018-11-13 17:13:40 +0100
committerNorbert Bartos <bartos.norbert@danubiusinfo.hu>2018-11-13 17:13:40 +0100
commit4c6ee6e25a68625fe7b0941db28681a69f1ce44a (patch)
tree3dd6651c1afa6a6355d3a642dd8e3b58dc6173d4 /spec
parent5fedccf46e545940213fcbadd870e461d61a29af (diff)
downloadsvg.js-4c6ee6e25a68625fe7b0941db28681a69f1ce44a.tar.gz
svg.js-4c6ee6e25a68625fe7b0941db28681a69f1ce44a.zip
Add unit tests
Diffstat (limited to 'spec')
-rw-r--r--spec/spec/doc.js8
-rw-r--r--spec/spec/element.js5
2 files changed, 13 insertions, 0 deletions
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() {