diff options
author | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2015-02-22 16:25:37 +0100 |
---|---|---|
committer | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2015-02-22 16:25:37 +0100 |
commit | e5b321e1c49928d5e7fceeeedec7fde91aa5e0f0 (patch) | |
tree | c1761e94f8cbdbf08388b07588c03c85b3189a1a /spec | |
parent | 095b474e110f7ed7f5920ca297607b58ed351128 (diff) | |
download | svg.js-e5b321e1c49928d5e7fceeeedec7fde91aa5e0f0.tar.gz svg.js-e5b321e1c49928d5e7fceeeedec7fde91aa5e0f0.zip |
Fixes #326
drawing.remove() now calls destroy() to remove the doc from the DOM
Diffstat (limited to 'spec')
-rwxr-xr-x | spec/spec/doc.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/spec/doc.js b/spec/spec/doc.js index 4312678..eabdd02 100755 --- a/spec/spec/doc.js +++ b/spec/spec/doc.js @@ -7,6 +7,10 @@ describe('Doc', function() { it('has a defs element', function() { expect(draw._defs instanceof SVG.Defs).toBe(true) }) + + it('has itself as doc', function() { + expect(draw.doc()).toBe(draw); + }) describe('defs()', function() { it('returns defs element', function(){ @@ -17,4 +21,22 @@ describe('Doc', function() { }) }) + describe('remove() / destroy()', function() { + it('removes the doc from the dom (remove)', function() { + draw.remove() + expect(draw.parent).toBeNull() + expect(document.getElementsByTagName('body')[0].querySelectorAll('svg').length).toBe(1) + draw = SVG(drawing).size(100,100); + expect(document.getElementsByTagName('body')[0].querySelectorAll('svg').length).toBe(2) + }) + + it('removes the doc from the dom (remove)', function() { + draw.destroy() + expect(draw.parent).toBeNull() + expect(document.getElementsByTagName('body')[0].querySelectorAll('svg').length).toBe(1) + draw = SVG(drawing).size(100,100); + expect(document.getElementsByTagName('body')[0].querySelectorAll('svg').length).toBe(2) + }) + }) + })
\ No newline at end of file |