Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ISSUE-6205, remove extra space from svg export #6209

Merged
merged 1 commit into from
Mar 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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