Skip to content

Commit beb6533

Browse files
committed
Add a fix for adding SVGs by their string value
1 parent f42d2d7 commit beb6533

6 files changed

Lines changed: 28 additions & 2 deletions

File tree

karma.conf.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ module.exports = (config) => {
8282

8383
// start these browsers
8484
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
85-
browsers: ['Chrome', 'Firefox', 'Safari'],
85+
browsers: ['Chrome', 'Firefox'],
8686

8787
// Continuous Integration mode
8888
// if true, Karma captures browsers, runs the tests and exits

plugins/svg.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ MIT license.
5555
*/
5656
var svgContent
5757
if (typeof svg === 'string') {
58-
svgContent = svg
58+
var div = document.createElement('div');
59+
div.innerHTML = svg
60+
svgContent = div.querySelector('svg').outerHTML
5961
}
6062
if (typeof svg === 'object') {
6163
svgContent = svg.outerHTML

tests/svg/icon.spec.js

Lines changed: 24 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
5.6 KB
Binary file not shown.
29.3 KB
Binary file not shown.

tests/svg/reference/icon.pdf

29.3 KB
Binary file not shown.

0 commit comments

Comments
 (0)