Skip to content

Commit

Permalink
fix(svg_export): remove extra space from svg export #6205 (#6209)
Browse files Browse the repository at this point in the history
  • Loading branch information
asturur authored Mar 8, 2020
1 parent 6ff7229 commit 68907ef
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
8 changes: 3 additions & 5 deletions src/mixins/object.svg_export.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,9 @@
* @return {String}
*/
getSvgTextDecoration: function(style) {
if ('overline' in style || 'underline' in style || 'linethrough' in style) {
return (style.overline ? 'overline ' : '') +
(style.underline ? 'underline ' : '') + (style.linethrough ? 'line-through ' : '');
}
return '';
return ['overline', 'underline', 'line-through'].filter(function(decoration) {
return style[decoration.replace('-', '')];
}).join(' ');
},

/**
Expand Down
8 changes: 4 additions & 4 deletions test/unit/text.js
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@
overline: true,
};
var styleString = iText.getSvgTextDecoration(styleObject);
var expected = 'overline ';
var expected = 'overline';
assert.equal(styleString, expected, 'style is as expected');
});
QUnit.test('getSvgTextDecoration with overline underline true produces correct output', function(assert){
Expand All @@ -655,7 +655,7 @@
underline: true,
};
var styleString = iText.getSvgTextDecoration(styleObject);
var expected = 'overline underline ';
var expected = 'overline underline';
assert.equal(styleString, expected, 'style is as expected with overline underline');
});
QUnit.test('getSvgTextDecoration with overline underline true produces correct output', function(assert){
Expand All @@ -666,7 +666,7 @@
linethrough: true,
};
var styleString = iText.getSvgTextDecoration(styleObject);
var expected = 'overline underline line-through ';
var expected = 'overline underline line-through';
assert.equal(styleString, expected, 'style is as expected with overline underline');
});

Expand All @@ -678,7 +678,7 @@
linethrough: true,
};
var styleString = iText.getSvgTextDecoration(styleObject);
var expected = 'overline underline line-through ';
var expected = 'overline underline line-through';
assert.equal(styleString, expected, 'style is as expected with overline underline');
});

Expand Down

0 comments on commit 68907ef

Please sign in to comment.