mirror of
https://github.com/Hopiu/fabric.js.git
synced 2026-05-26 22:14:01 +00:00
Fix Circle toSVG method adding an incorrect double quote (#5085)
* Fix Circle toSVG method adding an incorrect double quote * Add tests for Circle.toSVG
This commit is contained in:
parent
7c7c227f3c
commit
efa490fff0
2 changed files with 15 additions and 1 deletions
|
|
@ -114,7 +114,7 @@
|
|||
'" transform="', this.getSvgTransform(),
|
||||
' ', this.getSvgTransformMatrix(), '"',
|
||||
this.addPaintOrder(),
|
||||
'"/>\n'
|
||||
'/>\n'
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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, '<circle cx="0" cy="0" r="10" style="stroke: none; stroke-width: 1; stroke-dasharray: none; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 4; fill: rgb(0,0,0); fill-rule: nonzero; opacity: 1;" transform="translate(10.5 10.5) "/>\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, '<path d="M 10 0 A 10 10 0 0 1 -10 0" style="stroke: none; stroke-width: 1; stroke-dasharray: none; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 4; fill: rgb(0,0,0); fill-rule: nonzero; opacity: 1;" transform="translate(10.5 10.5) "/>\n');
|
||||
});
|
||||
|
||||
QUnit.test('fromElement', function(assert) {
|
||||
assert.ok(typeof fabric.Circle.fromElement === 'function');
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue