diff options
author | wout <wout@impinc.co.uk> | 2013-04-22 09:57:25 +0100 |
---|---|---|
committer | wout <wout@impinc.co.uk> | 2013-04-22 09:57:25 +0100 |
commit | 11ded2fe8fabf4392633fcdb3713a49e084746a1 (patch) | |
tree | 16c325b6261d8159bade92faf6b763acbccad148 /spec | |
parent | a736acc12e4ca1a71b9f563f7ed361e2a3540469 (diff) | |
download | svg.js-11ded2fe8fabf4392633fcdb3713a49e084746a1.tar.gz svg.js-11ded2fe8fabf4392633fcdb3713a49e084746a1.zip |
Added the rbox() method, bumped to v0.140.15
Diffstat (limited to 'spec')
-rw-r--r-- | spec/spec/element.js | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/spec/spec/element.js b/spec/spec/element.js index 167c0b9..e5db9b7 100644 --- a/spec/spec/element.js +++ b/spec/spec/element.js @@ -192,6 +192,45 @@ describe('Element', function() { var box = rect.bbox() expect(box.x).toBe(2) expect(box.y).toBe(12) + expect(box.cx).toBe(54.5) + expect(box.cy).toBe(117) + expect(box.width).toBe(105) + expect(box.height).toBe(210) + }) + it('should return the correct bounding within a viewbox', function() { + var rect = draw.size(300,200).viewbox(150,100).rect(105,210).move(2,12) + var box = rect.bbox() + expect(box.x).toBe(2) + expect(box.y).toBe(12) + expect(box.cx).toBe(54.5) + expect(box.cy).toBe(117) + expect(box.width).toBe(105) + expect(box.height).toBe(210) + }) + }) + + describe('rbox()', function() { + it('should return an instance of SVG.RBox', function() { + var rect = draw.rect(100,100) + expect(rect.rbox() instanceof SVG.RBox).toBe(true) + }) + it('should return the correct rectangular box', function() { + var rect = draw.size(200,150).viewbox(0,0,200,150).rect(105,210).move(2,12) + var box = rect.rbox() + expect(box.x).toBe(2) + expect(box.y).toBe(12) + expect(box.cx).toBe(54.5) + expect(box.cy).toBe(117) + expect(box.width).toBe(105) + expect(box.height).toBe(210) + }) + it('should return the correct rectangular box within a viewbox', function() { + var rect = draw.size(200,150).viewbox(0,0,100,75).rect(105,210).move(2,12) + var box = rect.rbox() + expect(box.x).toBe(2) + expect(box.y).toBe(12) + expect(box.cx).toBe(54.5) + expect(box.cy).toBe(117) expect(box.width).toBe(105) expect(box.height).toBe(210) }) |