summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2018-12-07 15:35:41 +0100
committerUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2018-12-07 15:35:41 +0100
commit7b02d60829d1151a9fd1e726a0a995b92b165328 (patch)
tree5a7c86988fedd7420d45336ee36edf98e109e8a1 /spec
parent5161dfdb3a08490da0ae1c5c8b6515eb0ae0da30 (diff)
downloadsvg.js-7b02d60829d1151a9fd1e726a0a995b92b165328.tar.gz
svg.js-7b02d60829d1151a9fd1e726a0a995b92b165328.zip
Release 3.0.43.0.4
Diffstat (limited to 'spec')
-rw-r--r--spec/spec/types/Box.js19
1 files changed, 18 insertions, 1 deletions
diff --git a/spec/spec/types/Box.js b/spec/spec/types/Box.js
index 1e98982..56eb7da 100644
--- a/spec/spec/types/Box.js
+++ b/spec/spec/types/Box.js
@@ -8,7 +8,7 @@ import {
import { getMethodsFor } from '../../../src/utils/methods.js'
import { getWindow, withWindow } from '../../../src/utils/window.js'
-const viewbox = getMethodsFor('viewbox').viewbox
+const { zoom, viewbox} = getMethodsFor('viewbox')
const { any, objectContaining, arrayContaining } = jasmine
@@ -175,5 +175,22 @@ describe('Box.js', () => {
expect(viewbox.call(canvas).toArray()).toEqual([10, 10, 200, 200])
})
})
+
+ describe('zoom()', () => {
+ it('zooms around the center by default', () => {
+ const canvas = zoom.call(SVG().size(100, 50).viewbox(0, 0, 100, 50).addTo(container), 2)
+ expect(canvas.attr('viewBox')).toEqual('25 12.5 50 25')
+ })
+
+ it('zooms around a point', () => {
+ const canvas = zoom.call(SVG().size(100, 50).viewbox(0, 0, 100, 50).addTo(container), 2, [0, 0])
+ expect(canvas.attr('viewBox')).toEqual('0 0 50 25')
+ })
+
+ it('gets the zoom', () => {
+ const canvas = zoom.call(SVG().size(100, 50).viewbox(0, 0, 100, 50).addTo(container), 2)
+ expect(zoom.call(canvas)).toEqual(2)
+ })
+ })
})
})