diff options
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 |