Skip to content

Commit

Permalink
feat: add testID prop to FAB and FAB.Group (#1573)
Browse files Browse the repository at this point in the history
  • Loading branch information
digorath committed Mar 27, 2020
1 parent 94ddfb0 commit 2313c26
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/components/FAB/FAB.tsx
Expand Up @@ -56,6 +56,7 @@ type Props = $RemoveChildren<typeof Surface> & {
* @optional
*/
theme: Theme;
testID?: string;
};

type State = {
Expand Down Expand Up @@ -143,6 +144,7 @@ class FAB extends React.Component<Props, State> {
style,
visible,
loading,
testID,
...rest
} = this.props;
const { visibility } = this.state;
Expand Down Expand Up @@ -207,6 +209,7 @@ class FAB extends React.Component<Props, State> {
accessibilityRole="button"
accessibilityStates={disabled ? ['disabled'] : []}
style={styles.touchable}
testID={testID}
>
<View
style={[
Expand Down
8 changes: 8 additions & 0 deletions src/components/FAB/FABGroup.tsx
Expand Up @@ -34,6 +34,7 @@ type Props = {
accessibilityLabel?: string;
style?: StyleProp<ViewStyle>;
onPress: () => void;
testID?: string;
}>;
/**
* Icon to display for the `FAB`.
Expand Down Expand Up @@ -78,6 +79,10 @@ type Props = {
* @optional
*/
theme: Theme;
/**
* Pass down testID from Group props to FAB.
*/
testID?: string;
};

type State = {
Expand Down Expand Up @@ -206,6 +211,7 @@ class FABGroup extends React.Component<Props, State> {
style,
fabStyle,
visible,
testID,
} = this.props;
const { colors } = theme;

Expand Down Expand Up @@ -307,6 +313,7 @@ class FABGroup extends React.Component<Props, State> {
accessibilityTraits="button"
accessibilityComponentType="button"
accessibilityRole="button"
testID={it.testID}
/>
</View>
))}
Expand All @@ -324,6 +331,7 @@ class FABGroup extends React.Component<Props, State> {
accessibilityRole="button"
style={[styles.fab, fabStyle]}
visible={visible}
testID={testID}
/>
</SafeAreaView>
</View>
Expand Down

0 comments on commit 2313c26

Please sign in to comment.