aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authordotnetCarpenter <jon.ronnenberg@gmail.com>2017-02-23 19:38:00 +0100
committerdotnetCarpenter <jon.ronnenberg@gmail.com>2017-02-23 21:15:52 +0100
commitd0ab36f7db15053c4fdda6d71906fd0dd8fd8be0 (patch)
tree9d93479bd76c1ea3638f495b9bd95ec4a89090ed /spec
parentceaf24d5a25bc815148d10eaea3112eb6ecf8488 (diff)
downloadsvg.js-d0ab36f7db15053c4fdda6d71906fd0dd8fd8be0.tar.gz
svg.js-d0ab36f7db15053c4fdda6d71906fd0dd8fd8be0.zip
remove SVG.TBox
Diffstat (limited to 'spec')
-rw-r--r--spec/spec/boxes.js59
-rw-r--r--spec/spec/circle.js4
-rw-r--r--spec/spec/ellipse.js4
-rw-r--r--spec/spec/image.js4
-rw-r--r--spec/spec/line.js8
-rw-r--r--spec/spec/path.js8
-rw-r--r--spec/spec/polygon.js8
-rw-r--r--spec/spec/polyline.js8
-rw-r--r--spec/spec/rect.js4
9 files changed, 26 insertions, 81 deletions
diff --git a/spec/spec/boxes.js b/spec/spec/boxes.js
index 6b49633..4b33be6 100644
--- a/spec/spec/boxes.js
+++ b/spec/spec/boxes.js
@@ -44,44 +44,8 @@ describe('BBox', function() {
describe('TBox', function() {
- afterEach(function() {
- draw.clear()
- })
-
- it('creates a new instance without passing an element', function() {
- var box = new SVG.TBox
- expect(box.x).toBe(0)
- expect(box.y).toBe(0)
- expect(box.cx).toBe(0)
- expect(box.cy).toBe(0)
- expect(box.width).toBe(0)
- expect(box.height).toBe(0)
- })
-
- describe('merge()', function() {
- it('merges various bounding boxes', function() {
- var box1 = draw.rect(100,100).move(50,50).bbox()
- var box2 = draw.rect(100,100).move(300,400).bbox()
- var box3 = draw.rect(100,100).move(500,100).bbox()
- var merged = box1.merge(box2).merge(box3)
- expect(merged.x).toBe(50)
- expect(merged.y).toBe(50)
- expect(merged.cx).toBe(325)
- expect(merged.cy).toBe(275)
- expect(merged.width).toBe(550)
- expect(merged.height).toBe(450)
- })
- it('returns a new bbox instance', function() {
- var box1 = draw.rect(100,100).move(50,50).bbox()
- var box2 = draw.rect(100,100).move(300,400).bbox()
- var merged = box1.merge(box2)
- expect(box1).not.toBe(merged)
- expect(box2).not.toBe(merged)
- expect(box1.x).toBe(50)
- expect(box1.y).toBe(50)
- expect(box2.x).toBe(300)
- expect(box2.y).toBe(400)
- })
+ it('should trow an error in 2.x and be removed in 3.x', function() {
+ expect(function() { new SVG.TBox }).toThrow('TBox is removed. Use RBox instead.')
})
})
@@ -169,25 +133,6 @@ describe('Boxes', function() {
})
})
- describe('tbox()', function() {
- it('returns an instance of SVG.TBox', function() {
- expect(rect.tbox() instanceof SVG.TBox).toBeTruthy()
- })
- it('matches the size of the target element, including transformations', function() {
- var box = rect.tbox()
- expect(box.x).toBe(35)
- expect(box.y).toBe(101)
- expect(box.cx).toBe(85)
- expect(box.cy).toBe(371)
- expect(box.width).toBe(100)
- expect(box.height).toBe(540)
- expect(box.w).toBe(100)
- expect(box.h).toBe(540)
- expect(box.x2).toBe(135)
- expect(box.y2).toBe(641)
- })
- })
-
describe('rbox()', function() {
it('returns an instance of SVG.RBox', function() {
expect(rect.rbox() instanceof SVG.RBox).toBeTruthy()
diff --git a/spec/spec/circle.js b/spec/spec/circle.js
index 498cd3a..16e93e0 100644
--- a/spec/spec/circle.js
+++ b/spec/spec/circle.js
@@ -154,13 +154,13 @@ describe('Circle', function() {
describe('scale()', function() {
it('should scale the element universally with one argument', function() {
- var box = circle.scale(2).tbox()
+ var box = circle.scale(2).rbox()
expect(box.width).toBe(circle.attr('r') * 2 * 2)
expect(box.height).toBe(circle.attr('r') * 2 * 2)
})
it('should scale the element over individual x and y axes with two arguments', function() {
- var box = circle.scale(2, 3.5).tbox()
+ var box = circle.scale(2, 3.5).rbox()
expect(box.width).toBe(circle.attr('r') * 2 * 2)
expect(box.height).toBe(circle.attr('r') * 2 * 3.5)
diff --git a/spec/spec/ellipse.js b/spec/spec/ellipse.js
index 2267d74..f6aa271 100644
--- a/spec/spec/ellipse.js
+++ b/spec/spec/ellipse.js
@@ -156,13 +156,13 @@ describe('Ellipse', function() {
describe('scale()', function() {
it('should scale the element universally with one argument', function() {
- var box = ellipse.scale(2).tbox()
+ var box = ellipse.scale(2).rbox()
expect(box.width).toBe(ellipse.attr('rx') * 2 * 2)
expect(box.height).toBe(ellipse.attr('ry') * 2 * 2)
})
it('should scale the element over individual x and y axes with two arguments', function() {
- var box = ellipse.scale(2, 3.5).tbox()
+ var box = ellipse.scale(2, 3.5).rbox()
expect(box.width).toBe(ellipse.attr('rx') * 2 * 2)
expect(box.height).toBe(ellipse.attr('ry') * 2 * 3.5)
diff --git a/spec/spec/image.js b/spec/spec/image.js
index a764265..2dabbaf 100644
--- a/spec/spec/image.js
+++ b/spec/spec/image.js
@@ -137,13 +137,13 @@ describe('Image', function() {
describe('scale()', function() {
it('should scale the element universally with one argument', function() {
- var box = image.scale(2).tbox()
+ var box = image.scale(2).rbox()
expect(box.width).toBe(image.attr('width') * 2)
expect(box.height).toBe(image.attr('height') * 2)
})
it('should scale the element over individual x and y axes with two arguments', function() {
- var box = image.scale(2, 3.5).tbox()
+ var box = image.scale(2, 3.5).rbox()
expect(box.width).toBe(image.attr('width') * 2)
expect(box.height).toBe(image.attr('height') * 3.5)
diff --git a/spec/spec/line.js b/spec/spec/line.js
index 1a62680..219043d 100644
--- a/spec/spec/line.js
+++ b/spec/spec/line.js
@@ -185,15 +185,15 @@ describe('Line', function() {
describe('scale()', function() {
it('should scale the element universally with one argument', function() {
- var box1 = line.tbox()
- , box2 = line.scale(2).tbox()
+ var box1 = line.rbox()
+ , box2 = line.scale(2).rbox()
expect(box2.width).toBe(box1.width * 2)
expect(box2.height).toBe(box1.height * 2)
})
it('should scale the element over individual x and y axes with two arguments', function() {
- var box1 = line.tbox()
- , box2 = line.scale(2,3.5).tbox()
+ var box1 = line.rbox()
+ , box2 = line.scale(2,3.5).rbox()
expect(box2.width).toBe(box1.width * 2)
expect(box2.height).toBe(box1.height * 3.5)
diff --git a/spec/spec/path.js b/spec/spec/path.js
index d8cf5b2..86db90d 100644
--- a/spec/spec/path.js
+++ b/spec/spec/path.js
@@ -169,15 +169,15 @@ describe('Path', function() {
describe('scale()', function() {
it('should scale the element universally with one argument', function() {
- var box1 = path.tbox()
- , box2 = path.scale(2).tbox()
+ var box1 = path.rbox()
+ , box2 = path.scale(2).rbox()
expect(box1.width * 2).toBe(box2.width)
expect(box1.height * 2).toBe(box2.height)
})
it('should scale the element over individual x and y axes with two arguments', function() {
- var box1 = path.tbox()
- , box2 = path.scale(2, 3.5).tbox()
+ var box1 = path.rbox()
+ , box2 = path.scale(2, 3.5).rbox()
expect(box1.width * 2).toBe(box2.width)
expect(box1.height * 3.5).toBe(box2.height)
diff --git a/spec/spec/polygon.js b/spec/spec/polygon.js
index 2af0815..34d0969 100644
--- a/spec/spec/polygon.js
+++ b/spec/spec/polygon.js
@@ -163,15 +163,15 @@ describe('Polygon', function() {
describe('scale()', function() {
it('should scale the element universally with one argument', function() {
- var box1 = polygon.tbox()
- , box2 = polygon.scale(2).tbox()
+ var box1 = polygon.rbox()
+ , box2 = polygon.scale(2).rbox()
expect(box2.width).toBe(box1.width * 2)
expect(box2.height).toBe(box1.height * 2)
})
it('should scale the element over individual x and y axes with two arguments', function() {
- var box1 = polygon.tbox()
- , box2 = polygon.scale(2, 3.5).tbox()
+ var box1 = polygon.rbox()
+ , box2 = polygon.scale(2, 3.5).rbox()
expect(box2.width).toBe(box1.width * 2)
expect(box2.height).toBe(box1.height * 3.5)
diff --git a/spec/spec/polyline.js b/spec/spec/polyline.js
index ecd9991..aa7120c 100644
--- a/spec/spec/polyline.js
+++ b/spec/spec/polyline.js
@@ -163,15 +163,15 @@ describe('Polyline', function() {
describe('scale()', function() {
it('should scale the element universally with one argument', function() {
- var box1 = polyline.tbox()
- , box2 = polyline.scale(2).tbox()
+ var box1 = polyline.rbox()
+ , box2 = polyline.scale(2).rbox()
expect(box2.width).toBe(box1.width * 2)
expect(box2.height).toBe(box1.height * 2)
})
it('should scale the element over individual x and y axes with two arguments', function() {
- var box1 = polyline.tbox()
- , box2 = polyline.scale(2, 3.5).tbox()
+ var box1 = polyline.rbox()
+ , box2 = polyline.scale(2, 3.5).rbox()
expect(box2.width).toBe(box1.width * 2)
expect(box2.height).toBe(box1.height * 3.5)
diff --git a/spec/spec/rect.js b/spec/spec/rect.js
index cd82d39..84de937 100644
--- a/spec/spec/rect.js
+++ b/spec/spec/rect.js
@@ -150,13 +150,13 @@ describe('Rect', function() {
describe('scale()', function() {
it('should scale the element universally with one argument', function() {
- var box = rect.scale(2).tbox()
+ var box = rect.scale(2).rbox()
expect(box.width).toBe(rect.attr('width') * 2)
expect(box.height).toBe(rect.attr('height') * 2)
})
it('should scale the element over individual x and y axes with two arguments', function() {
- var box = rect.scale(2, 3.5).tbox()
+ var box = rect.scale(2, 3.5).rbox()
expect(box.width).toBe(rect.attr('width') * 2)
expect(box.height).toBe(rect.attr('height') * 3.5)