diff --git a/src/option/ProductOptionSelector.js b/src/option/ProductOptionSelector.js index 31689584..95f0c594 100644 --- a/src/option/ProductOptionSelector.js +++ b/src/option/ProductOptionSelector.js @@ -56,6 +56,7 @@ export default function ProductOptionSelector({ key={option.id} className={clsx(classes.button, optionProps.className)} index={i} + color={option.color} imageProps={option.image} value={option} skeleton={skeleton != null} diff --git a/src/option/SwatchProductOption.js b/src/option/SwatchProductOption.js index a6a8dd19..cdd6ae9b 100644 --- a/src/option/SwatchProductOption.js +++ b/src/option/SwatchProductOption.js @@ -177,6 +177,7 @@ export default function SwatchProductOption({ selected, label, classes, + color, imageProps, onClick, SelectedIcon, @@ -225,15 +226,25 @@ export default function SwatchProductOption({ > - + {color ? ( +
+ ) : ( + + )} {disabled && strikeThroughDisabled && (
{ .hasClass(/strikeThrough/), ).toEqual(true) }) + + it('should set the background color based on the color prop', () => { + const option = { id: 'test', color: '#ffffff' } + + wrapper = mount( + , + ) + + expect(wrapper.find('button > div + div').props().style.backgroundColor).toEqual(option.color) + }) })