From 98162bbb39f0439766f09cdd5fe0049548953c42 Mon Sep 17 00:00:00 2001 From: Nicolas Morel Date: Thu, 12 Jul 2018 15:31:47 +0200 Subject: [PATCH] Fix Circle toSVG method adding an incorrect double quote (#5085) * Fix Circle toSVG method adding an incorrect double quote * Add tests for Circle.toSVG --- src/shapes/circle.class.js | 2 +- test/unit/circle.js | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/shapes/circle.class.js b/src/shapes/circle.class.js index ab89ad6f8ae..6134f7d6194 100644 --- a/src/shapes/circle.class.js +++ b/src/shapes/circle.class.js @@ -114,7 +114,7 @@ '" transform="', this.getSvgTransform(), ' ', this.getSvgTransformMatrix(), '"', this.addPaintOrder(), - '"/>\n' + '/>\n' ); } diff --git a/test/unit/circle.js b/test/unit/circle.js index a6b9e5932ba..73f5f0e5c9e 100644 --- a/test/unit/circle.js +++ b/test/unit/circle.js @@ -137,6 +137,20 @@ assert.deepEqual(circle.toObject(), augmentedProperties); }); + QUnit.test('toSVG with full circle', function(assert) { + var circle = new fabric.Circle({ width: 100, height: 100, radius: 10 }); + var svg = circle.toSVG(); + + assert.equal(svg, '\n'); + }); + + QUnit.test('toSVG with half circle', function(assert) { + var circle = new fabric.Circle({ width: 100, height: 100, radius: 10, endAngle: Math.PI }); + var svg = circle.toSVG(); + + assert.equal(svg, '\n'); + }); + QUnit.test('fromElement', function(assert) { assert.ok(typeof fabric.Circle.fromElement === 'function');