Skip to content

Commit

Permalink
wait what
Browse files Browse the repository at this point in the history
  • Loading branch information
louh committed Dec 6, 2020
1 parent 0237aa1 commit 987825e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/inputProcessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,14 @@ function getSource(svg, {css = 'inline'} = {}) {

const source = new XMLSerializer().serializeToString(svg)
const rect = svg.getBoundingClientRect()
const width = svg.width.baseVal.value
const height = svg.height.baseVal.value

const result = {
top: rect.top,
left: rect.left,
width: svg.width.baseVal.value,
height: svg.height.baseVal.value,
width: typeof width !== 'undefined' ? width : rect.width,
height: typeof height !== 'undefined' ? height : rect.height,
class: svg.getAttribute('class'),
id: svg.getAttribute('id'),
name: svg.getAttribute('name'),
Expand Down
2 changes: 2 additions & 0 deletions test/png.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ test('pgn download requires source', () => {
})

test('download succeeds with empty SVG', () => {
const testsvg = createSVG()
console.log(testsvg.width.baseVal, testsvg.height.baseVal)
expect(() => download(inputProcessor(createSVG()))).not.toThrow()
})

Expand Down

0 comments on commit 987825e

Please sign in to comment.