From 7990dc47fda4f3b850c18318775ab108c2aff8f5 Mon Sep 17 00:00:00 2001 From: Ulrich-Matthias Schäfer Date: Sat, 26 May 2018 20:59:57 +0200 Subject: fixed issues in SVG.Doc and SVG.Mask when cloning(#782) --- spec/spec/doc.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'spec') diff --git a/spec/spec/doc.js b/spec/spec/doc.js index 17bcb28..bec6fb4 100644 --- a/spec/spec/doc.js +++ b/spec/spec/doc.js @@ -42,10 +42,25 @@ describe('Doc', function() { }else{ expect(window.document.querySelectorAll('svg').length).toBe(cnt-1) } - + draw = SVG(drawing).size(100,100); expect(window.document.querySelectorAll('svg').length).toBe(cnt) }) }) + describe('clone()', function () { + it('clones the doc and inserts the clone after the doc', function () { + var clone = draw.clone() + + expect(draw.node.nextSibling).toBe(clone.node) + clone.remove() + }) + it('clones the doc and inserts the clone in the provided parent', function () { + var el = document.createElement('div') + var clone = draw.clone(el) + + expect(clone.node.parentNode).toBe(el) + }) + }) + }) -- cgit v1.2.3