Merge pull request #60 from iqnivek/fix-root-style-hook

Use styles.root properly
This commit is contained in:
Kevin Qi 2018-06-23 22:14:00 -07:00 committed by GitHub
commit 415ff376e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 3 deletions

View File

@ -103,6 +103,7 @@ class CircularProgressbar extends React.Component {
return (
<svg
className={`${classes.root} ${className} ${classForPercentage}`}
style={styles.root}
viewBox={`0 0 ${MAX_X} ${MAX_Y}`}
>
{

View File

@ -119,15 +119,35 @@ describe('CircularProgressbar props', () => {
const wrapper = shallow(
<CircularProgressbar
percentage={50}
background
styles={{
path: { stroke: '#ffffff' },
root: { stroke: '#000000' },
trail: { stroke: '#111111' },
path: { stroke: '#222222' },
text: { stroke: '#333333' },
background: { stroke: '#444444' },
}}
/>
);
assert.equal(
wrapper.find('.CircularProgressbar').prop('style').stroke,
'#000000',
);
assert.equal(
wrapper.find('.CircularProgressbar-trail').prop('style').stroke,
'#111111',
);
assert.equal(
wrapper.find('.CircularProgressbar-path').prop('style').stroke,
'#ffffff',
'#222222',
);
assert.equal(
wrapper.find('.CircularProgressbar-text').prop('style').stroke,
'#333333',
);
assert.equal(
wrapper.find('.CircularProgressbar-background').prop('style').stroke,
'#444444',
);
});
});