Skip to content

Commit 9f3cb79

Browse files
committed
fix(Arrow): allow style.width and style.height to be overridden
1 parent 337192f commit 9f3cb79

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ L${point(-shaftLength, shaftWidth / 2)}${unclosed ? '' : ' z'}`
119119
propsForPath.clipPath = `url(#${clipPathId})`
120120
}
121121
const style = propsForSvg.style = (propsForSvg.style ? {...propsForSvg.style} : {})
122-
style.width = width
123-
style.height = height
122+
if (style.width == null) style.width = width
123+
if (style.height == null) style.height = height
124124

125125
return (
126126
<svg {...propsForSvg}>

test/index.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,5 +191,21 @@ L15,0
191191
L5,0
192192
L5,-10 z`)
193193
})
194+
it('allows style.width and style.height to be overridden', () => {
195+
const comp = mount(
196+
<Arrow
197+
direction="down"
198+
shaftWidth={10}
199+
shaftLength={10}
200+
headWidth={30}
201+
headLength={15}
202+
style={{width: 3, height: 4}}
203+
/>
204+
)
205+
const svg = comp.find('svg')
206+
const style = svg.prop('style')
207+
expect(style.width).to.equal(3)
208+
expect(style.height).to.equal(4)
209+
})
194210
})
195211

0 commit comments

Comments
 (0)