diff options
author | wout <wout@impinc.co.uk> | 2013-05-29 16:35:33 +0100 |
---|---|---|
committer | wout <wout@impinc.co.uk> | 2013-05-29 16:35:33 +0100 |
commit | 1f3eeddc4a188d0d9a1b581e2ce32106112bfdfc (patch) | |
tree | a2f4936c1026a812f52501364056efbae1987713 /spec | |
parent | 13a9d3be70047bfb7284651735216f11c7a24965 (diff) | |
download | svg.js-1f3eeddc4a188d0d9a1b581e2ce32106112bfdfc.tar.gz svg.js-1f3eeddc4a188d0d9a1b581e2ce32106112bfdfc.zip |
Added translate() method
Diffstat (limited to 'spec')
-rw-r--r-- | spec/spec/ellipse.js | 7 | ||||
-rw-r--r-- | spec/spec/image.js | 7 | ||||
-rw-r--r-- | spec/spec/line.js | 7 | ||||
-rw-r--r-- | spec/spec/path.js | 7 | ||||
-rw-r--r-- | spec/spec/polygon.js | 7 | ||||
-rw-r--r-- | spec/spec/polyline.js | 7 | ||||
-rw-r--r-- | spec/spec/rect.js | 7 | ||||
-rw-r--r-- | spec/spec/text.js | 7 |
8 files changed, 56 insertions, 0 deletions
diff --git a/spec/spec/ellipse.js b/spec/spec/ellipse.js index 00215f8..b19aa57 100644 --- a/spec/spec/ellipse.js +++ b/spec/spec/ellipse.js @@ -93,6 +93,13 @@ describe('Ellipse', function() { expect(box.height).toBe(ellipse.attr('ry') * 2 * 3.5) }) }) + + describe('translate()', function() { + it('should set the translation of an element', function() { + ellipse.transform({ x: 12, y: 12 }) + expect(ellipse.node.getAttribute('transform')).toBe('translate(12,12)') + }) + }) }) diff --git a/spec/spec/image.js b/spec/spec/image.js index 05f56b2..544a937 100644 --- a/spec/spec/image.js +++ b/spec/spec/image.js @@ -92,6 +92,13 @@ describe('Image', function() { expect(box.height).toBe(image.attr('height') * 3.5) }) }) + + describe('translate()', function() { + it('should set the translation of an element', function() { + image.transform({ x: 12, y: 12 }) + expect(image.node.getAttribute('transform')).toBe('translate(12,12)') + }) + }) }) diff --git a/spec/spec/line.js b/spec/spec/line.js index b49d0e1..f70caba 100644 --- a/spec/spec/line.js +++ b/spec/spec/line.js @@ -98,6 +98,13 @@ describe('Line', function() { expect(box.height).toBe((line.attr('y1') - line.attr('y2')) * 3.5) }) }) + + describe('translate()', function() { + it('should set the translation of an element', function() { + line.transform({ x: 12, y: 12 }) + expect(line.node.getAttribute('transform')).toBe('translate(12,12)') + }) + }) describe('plot()', function() { it('should update the start and end points', function() { diff --git a/spec/spec/path.js b/spec/spec/path.js index 2ba269e..bb312ad 100644 --- a/spec/spec/path.js +++ b/spec/spec/path.js @@ -100,6 +100,13 @@ describe('Path', function() { expect(box.height).toBe(path._offset.height * 3.5) }) }) + + describe('translate()', function() { + it('should set the translation of an element', function() { + path.transform({ x: 12, y: 12 }) + expect(path.node.getAttribute('transform')).toBe('translate(12,12) translate(0,0)') + }) + }) }) diff --git a/spec/spec/polygon.js b/spec/spec/polygon.js index 2d4cac5..93b4e38 100644 --- a/spec/spec/polygon.js +++ b/spec/spec/polygon.js @@ -94,6 +94,13 @@ describe('Polygon', function() { expect(box.height).toBe(polygon._offset.height * 3.5) }) }) + + describe('translate()', function() { + it('should set the translation of an element', function() { + polygon.transform({ x: 12, y: 12 }) + expect(polygon.node.getAttribute('transform')).toBe('translate(12,12) translate(0,0)') + }) + }) }) diff --git a/spec/spec/polyline.js b/spec/spec/polyline.js index 5fef850..f959795 100644 --- a/spec/spec/polyline.js +++ b/spec/spec/polyline.js @@ -94,6 +94,13 @@ describe('Polyline', function() { expect(box.height).toBe(polyline._offset.height * 3.5) }) }) + + describe('translate()', function() { + it('should set the translation of an element', function() { + polyline.transform({ x: 12, y: 12 }) + expect(polyline.node.getAttribute('transform')).toBe('translate(12,12) translate(0,0)') + }) + }) }) diff --git a/spec/spec/rect.js b/spec/spec/rect.js index 8452ba5..61b9363 100644 --- a/spec/spec/rect.js +++ b/spec/spec/rect.js @@ -92,6 +92,13 @@ describe('Rect', function() { expect(box.height).toBe(rect.attr('height') * 3.5) }) }) + + describe('translate()', function() { + it('should set the translation of an element', function() { + rect.transform({ x: 12, y: 12 }) + expect(rect.node.getAttribute('transform')).toBe('translate(12,12)') + }) + }) }) diff --git a/spec/spec/text.js b/spec/spec/text.js index 83fd23a..18acec6 100644 --- a/spec/spec/text.js +++ b/spec/spec/text.js @@ -102,6 +102,13 @@ describe('Text', function() { expect(text.style('font-size')).toBe(50) }) }) + + describe('translate()', function() { + it('should set the translation of an element', function() { + text.transform({ x: 12, y: 12 }) + expect(text.node.getAttribute('transform')).toBe('translate(12,12)') + }) + }) }) |