diff --git a/__tests__/ratings.test.js b/__tests__/ratings.test.js index 8c94138..14b06ce 100644 --- a/__tests__/ratings.test.js +++ b/__tests__/ratings.test.js @@ -24,7 +24,7 @@ test('Ratings renders correctly', ()=> { svgIconPath="M2 1 h1 v1 h1 v1 h-1 v1 h-1 v-1 h-1 v-1 h1 z" /> - ); @@ -55,7 +55,7 @@ it('changes rating when clicked', ()=> { svgIconPath="M2 1 h1 v1 h1 v1 h-1 v1 h-1 v-1 h-1 v-1 h1 z" /> - ); @@ -70,4 +70,31 @@ it('changes rating when clicked', ()=> { fourthStar = wrapper.find(Ratings.Widget).at(3); expect(fourthStar.prop('isSelected')).toBe(true); expect(wrapper.prop('rating')).toEqual(NEXT_RATING); -}); \ No newline at end of file +}); + +it('passes Widget extra props down to the div', () => { + const wrapper = mount( + {}} + > + + + + + + + ); + expect(wrapper.find('div[data-testid="star-1"]').length).toEqual(1); + expect(wrapper.find('div[data-testid="star-2"]').length).toEqual(1); + expect(wrapper.find('div#five-stars').length).toEqual(1); +}); diff --git a/src/widget.js b/src/widget.js index dc78f74..017b635 100644 --- a/src/widget.js +++ b/src/widget.js @@ -150,7 +150,23 @@ class Widget extends Component { svgIconViewBox, svgIconPath, svg, - hasCustomGradientColor + hasCustomGradientColor, + gradientPathName, + hoverMode, + ignoreInlineStyles, + isCurrentHoveredWidget, + isFirstWidget, + isHovered, + isLastWidget, + isPartiallyFullWidget, + isSelected, + selectedRating, + widgetDimension, + widgetEmptyColor, + widgetHoverColor, + widgetRatedColor, + widgetSpacing, + ...otherProps } = this.props; let customSvg = svg; if (React.isValidElement(customSvg)) { @@ -166,6 +182,7 @@ class Widget extends Component { onMouseEnter={hoverOverWidget} onMouseLeave={unHoverOverWidget} onClick={changeRating} + {...otherProps} > {customSvg ? customSvg :