summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2021-06-13 22:39:18 +0200
committerUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2021-06-13 22:39:18 +0200
commit34062cfa7731ab0c0d1df94b931fede0c57f1f09 (patch)
tree25048be424b0d78708c4dc026696e090379c4252 /spec
parent530f3755991149827974c1ecfa0ca046e9b653b8 (diff)
downloadsvg.js-34062cfa7731ab0c0d1df94b931fede0c57f1f09.tar.gz
svg.js-34062cfa7731ab0c0d1df94b931fede0c57f1f09.zip
fix group move bug when group contains elements without dimensions, update deps
Diffstat (limited to 'spec')
-rw-r--r--spec/spec/modules/core/containerGeometry.js19
1 files changed, 18 insertions, 1 deletions
diff --git a/spec/spec/modules/core/containerGeometry.js b/spec/spec/modules/core/containerGeometry.js
index 7bbd2c9..740f99f 100644
--- a/spec/spec/modules/core/containerGeometry.js
+++ b/spec/spec/modules/core/containerGeometry.js
@@ -1,6 +1,6 @@
/* globals describe, expect, it, jasmine, spyOn, container */
-import { Box, G, Rect, SVG } from '../../../../src/main.js'
+import { Box, create, Element, G, Rect, SVG } from '../../../../src/main.js'
const { any, objectContaining } = jasmine
@@ -42,6 +42,23 @@ describe('containerGeometry.js', () => {
expect(newBox.w).toBeCloseTo(oldBox.w, 4)
expect(newBox.h).toBeCloseTo(oldBox.h, 4)
})
+
+ it('it does not fail when hitting elements without bbox', () => {
+ const canvas = SVG().addTo(container)
+ const g = canvas.group()
+
+ g.add(new Rect({ width: 100, height: 120, x: 10, y: 20 }))
+ g.add(new Rect({ width: 70, height: 100, x: 50, y: 60 }))
+ g.add(new Element(create('title')))
+
+ const fn = () => g.dmove(10, 10)
+ expect(fn).not.toThrowError()
+
+ const box = g.bbox()
+ expect(box).toEqual(objectContaining({
+ x: 20, y: 30, width: box.width, height: box.height
+ }))
+ })
})
describe('dx()', () => {