From 7b02d60829d1151a9fd1e726a0a995b92b165328 Mon Sep 17 00:00:00 2001 From: Ulrich-Matthias Schäfer Date: Fri, 7 Dec 2018 15:35:41 +0100 Subject: Release 3.0.4 --- spec/spec/types/Box.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'spec') 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) + }) + }) }) }) -- cgit v1.2.3