我正在使用开玩笑的酶来测试一个反应应用。我们正在使用Material UI,并且遇到了用于更改颜色的功能的问题。这是一个简单的函数调用,但是其接收的参数未定义。
函数调用(colorTransparentizer)
const { classes, customClass } = props
const theme = useTheme()
const border = `solid 1px ${props.iconFillBorder ? props.iconFillBorder:colorTransparentizer(theme.palette.foundation, .25)}`
const iconColor = props.iconFill ? props.iconFill : theme.palette.const iconFill = props.iconFill ? props.iconFill : colorTransparentizer(theme.palette.foundation, .25)
const backgroundColor = props.background ? props.background : 'initial'
const styles = {
color: iconColor,
fill: iconFill,
border: border,
backgroundColor: backgroundColor
}
用法
return <div style={styles} className={`${classes.buttonContainer} ${customClass}`} onClick={props.onClick}>{props.children}</div>
第一个参数,主题颜色,未定义。想知道是否有可能在测试时将其纳入范围。似乎并不在乎何时在JSS中调用它,而仅在组件本身中调用。