From 30df220d96e813e0dab08a08ebb00ba9cfa25352 Mon Sep 17 00:00:00 2001 From: Ulrich-Matthias Schäfer Date: Fri, 15 Apr 2016 19:53:58 +0200 Subject: fixed bug in `add()` and `SVG.Doc().create()` --- spec/spec/doc.js | 20 ++++++++++++++------ spec/spec/svg.js | 6 +++++- 2 files changed, 19 insertions(+), 7 deletions(-) (limited to 'spec') diff --git a/spec/spec/doc.js b/spec/spec/doc.js index 9696935..e25bd20 100644 --- a/spec/spec/doc.js +++ b/spec/spec/doc.js @@ -1,5 +1,13 @@ describe('Doc', function() { - + + describe('create()', function(){ + it('doenst alter size when adopting width SVG()', function() { + var svg = SVG('inlineSVG') + expect(svg.width()).toBe(0) + expect(svg.height()).toBe(0) + }) + }) + it('is an instance of SVG.Container', function() { expect(draw instanceof SVG.Container).toBe(true) }) @@ -7,11 +15,11 @@ describe('Doc', function() { it('is an instance of SVG.Doc', function() { expect(draw instanceof SVG.Doc).toBe(true) }) - + it('returns itself as Doc', function() { expect(draw.doc()).toBe(draw) }) - + it('has a defs element', function() { expect(draw.defs() instanceof SVG.Defs).toBe(true) }) @@ -24,7 +32,7 @@ describe('Doc', function() { expect(draw.defs().parent()).toBe(draw) }) }) - + describe('remove()', function() { it('removes the doc from the dom', function() { draw.remove() @@ -33,5 +41,5 @@ describe('Doc', function() { expect(document.getElementsByTagName('body')[0].querySelectorAll('svg').length).toBe(3) }) }) - -}) \ No newline at end of file + +}) diff --git a/spec/spec/svg.js b/spec/spec/svg.js index cc9f7be..63df0b9 100644 --- a/spec/spec/svg.js +++ b/spec/spec/svg.js @@ -19,6 +19,10 @@ describe('SVG', function() { it('creates an instance of SVG.Doc', function() { expect(drawing instanceof SVG.Doc).toBe(true) }) + it('sets size to 100%', function() { + expect(drawing.width()).toBe('100%') + expect(drawing.height()).toBe('100%') + }) }) describe('create()', function() { @@ -66,7 +70,7 @@ describe('SVG', function() { expect(typeof SVG.Path.prototype.soft).toBe('function') expect(draw.path().soft().attr('opacity')).toBe(0.5) }) - it('ignones non existant objects', function() { + it('ignores non existant objects', function() { SVG.extend(SVG.Rect, SVG.Bogus, { soft: function() { return this.opacity(0.3) -- cgit v1.2.3