diff --git a/src/transform-applier.js b/src/transform-applier.js index 6dce3cd8..2e85a4a3 100644 --- a/src/transform-applier.js +++ b/src/transform-applier.js @@ -538,6 +538,8 @@ const transformStrokeWidths = function (svgTag, windowRef, bboxForTesting) { matrix = Matrix.compose(matrix, _parseTransform(element)); if (Matrix.toString(matrix) === Matrix.toString(Matrix.identity())) { element.removeAttribute('transform'); + element.setAttribute('stroke-width', strokeWidth); + element.setAttribute('fill', fill); return; } diff --git a/test/test-output/transform-applier-test.html b/test/test-output/transform-applier-test.html index ff91beac..be0edfe1 100644 --- a/test/test-output/transform-applier-test.html +++ b/test/test-output/transform-applier-test.html @@ -348,6 +348,26 @@ + +

blackFillsBugFix

+
+ + + + + + + +
+
+ + + + + +
\ No newline at end of file diff --git a/test/transform-applier.js b/test/transform-applier.js index ec2c4bdd..b9045cf5 100644 --- a/test/transform-applier.js +++ b/test/transform-applier.js @@ -767,4 +767,30 @@ test('userSpaceRadialGradientTransform', t => { t.end(); }); +test('blackFillsBugFix', t => { + const svgString = + ` + + + + + + `; + const svgElement = parser.parseFromString(svgString, 'text/xml').documentElement; + transformStrokeWidths(svgElement, window, + { + height: 12.5, + width: 24.020904541015625, + x: 0.9896308183670044, + y: 0.75 + }); + comparisonFileAppend(svgString, svgElement, 'blackFillsBugFix'); + t.equals('none', svgElement.getElementById('Shape').attributes.fill.value); + t.equals('5', svgElement.getElementById('Shape').attributes['stroke-width'].value); + + t.end(); +}); + outputComparisonFile();