forked from Ivasoft/mattermost-mobile
Add testID for radio item option
This commit is contained in:
committed by
Elisabeth Kulzer
parent
bda9b10d7d
commit
21ae37353e
@@ -175,10 +175,12 @@ const OptionItem = ({
|
||||
/>
|
||||
);
|
||||
} else if (type === OptionType.RADIO) {
|
||||
const radioComponentTestId = selected ? `${testID}.selected` : `${testID}.not_selected`;
|
||||
radioComponent = (
|
||||
<RadioItem
|
||||
selected={Boolean(selected)}
|
||||
{...radioItemProps}
|
||||
testID={radioComponentTestId}
|
||||
/>
|
||||
);
|
||||
} else if (type === OptionType.TOGGLE) {
|
||||
|
||||
@@ -38,8 +38,9 @@ const getStyleSheet = makeStyleSheetFromTheme((theme) => {
|
||||
export type RadioItemProps = {
|
||||
selected: boolean;
|
||||
checkedBody?: boolean;
|
||||
testID?: string;
|
||||
}
|
||||
const RadioItem = ({selected, checkedBody}: RadioItemProps) => {
|
||||
const RadioItem = ({selected, checkedBody, testID}: RadioItemProps) => {
|
||||
const theme = useTheme();
|
||||
const styles = getStyleSheet(theme);
|
||||
|
||||
@@ -60,7 +61,10 @@ const RadioItem = ({selected, checkedBody}: RadioItemProps) => {
|
||||
}, [checkedBody]);
|
||||
|
||||
return (
|
||||
<View style={[styles.ring, !selected && styles.inActive]}>
|
||||
<View
|
||||
style={[styles.ring, !selected && styles.inActive]}
|
||||
testID={testID}
|
||||
>
|
||||
{selected && getBody()}
|
||||
</View>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user