summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2017-04-09 21:02:20 +0200
committerUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2017-04-09 21:02:20 +0200
commit4dd7ce338880d05ff0ea03d9b730126bcee99356 (patch)
tree1eef5fb84e110d6ab04cf79a7cefb3bff8b2d9d9
parent270874248df9a034b24d49d8db00cba6529e7f4b (diff)
downloadsvg.js-4dd7ce338880d05ff0ea03d9b730126bcee99356.tar.gz
svg.js-4dd7ce338880d05ff0ea03d9b730126bcee99356.zip
make last test passing in svg docs
-rw-r--r--dist/svg.js6
-rw-r--r--spec/spec/doc.js9
-rw-r--r--spec/spec/helper.js15
-rw-r--r--src/doc.js4
4 files changed, 18 insertions, 16 deletions
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 <wout@mick-wout.com>
* @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