From: Ulrich-Matthias Schäfer Date: Sun, 9 Apr 2017 19:02:20 +0000 (+0200) Subject: make last test passing in svg docs X-Git-Tag: 2.5.2~8 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=4dd7ce338880d05ff0ea03d9b730126bcee99356;p=svg.js.git make last test passing in svg docs --- diff --git a/dist/svg.js b/dist/svg.js index 5e1d237..b086ba4 100644 --- a/dist/svg.js +++ b/dist/svg.js @@ -6,7 +6,7 @@ * @copyright Wout Fierens * @license MIT * -* BUILT: Wed Mar 29 2017 16:04:59 GMT+0200 (Mitteleuropäische Sommerzeit) +* BUILT: Sun Apr 09 2017 16:00:39 GMT+0200 (Mitteleuropäische Sommerzeit) */; (function(root, factory) { if (typeof define === 'function' && define.amd) { @@ -3976,10 +3976,10 @@ SVG.Doc = SVG.invent({ // Removes the doc from the DOM , remove: function() { if(this.parent()) { - this.parent().removeChild(this.node); + this.parent().removeChild(this.node) } - return this; + return this } , clear: function() { // remove children diff --git a/spec/spec/doc.js b/spec/spec/doc.js index 03828a4..17bcb28 100644 --- a/spec/spec/doc.js +++ b/spec/spec/doc.js @@ -34,10 +34,15 @@ describe('Doc', function() { }) describe('remove()', function() { - it('removes the doc from the dom', function() { + it('removes the doc from the dom only if doc is not root element', function() { var cnt = window.document.querySelectorAll('svg').length draw.remove() - expect(window.document.querySelectorAll('svg').length).toBe(cnt-1) + if(parserInDoc){ + expect(window.document.querySelectorAll('svg').length).toBe(cnt) + }else{ + expect(window.document.querySelectorAll('svg').length).toBe(cnt-1) + } + draw = SVG(drawing).size(100,100); expect(window.document.querySelectorAll('svg').length).toBe(cnt) }) diff --git a/spec/spec/helper.js b/spec/spec/helper.js index e23778f..9589695 100644 --- a/spec/spec/helper.js +++ b/spec/spec/helper.js @@ -104,21 +104,18 @@ if(typeof exports === 'object'){ id: 'labelGroup' },[ tag('text', { - id: 'pointA', - cx: '100', - cy: '350', + x: '100', + y: '350', dy: '-30', }, ['A']), tag('text', { - id: 'pointB', - cx: '250', - cy: '50', + x: '250', + y: '50', dy: '-10', }, ['B']), tag('text', { - id: 'pointC', - cx: '400', - cy: '350', + x: '400', + y: '350', dx: '30', }, ['C']) ]), diff --git a/src/doc.js b/src/doc.js index c6da348..6a48a6a 100644 --- a/src/doc.js +++ b/src/doc.js @@ -71,10 +71,10 @@ SVG.Doc = SVG.invent({ // Removes the doc from the DOM , remove: function() { if(this.parent()) { - this.parent().removeChild(this.node); + this.parent().removeChild(this.node) } - return this; + return this } , clear: function() { // remove children