Skip to content

Commit e4731a2

Browse files
audrius-savickasInbal-Tish
authored andcommitted
Tests/Add testID to AnimatedScanner (#2458)
* add testID to AnimatedScanner * update API * Update src/components/animatedScanner/index.js fix lint --------- Co-authored-by: Inbal Tish <[email protected]>
1 parent 9a3ffa7 commit e4731a2

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/components/animatedScanner/animatedScanner.api.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
{"name": "backgroundColor", "type": "string", "description": "Background color"},
1919
{"name": "onBreakpoint", "type": "({progress, isDone}) => void", "description": "Breakpoint callback"},
2020
{"name": "hideScannerLine", "type": "boolean", "description": "Whether to hide the scanner line"},
21-
{"name": "containerStyle", "type": "ViewStyle", "description": "Component's container style"}
21+
{"name": "containerStyle", "type": "ViewStyle", "description": "Component's container style"},
22+
{"name": "testID", "type": "string", "description": "Used as a testing identifier"}
2223
],
2324
"snippet": [
2425
"<AnimatedScanner progress={55$1} duration={1600$2}/>"

src/components/animatedScanner/index.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,11 @@ export default class AnimatedScanner extends BaseComponent {
4545
/**
4646
* the container style
4747
*/
48-
containerStyle: ViewPropTypes.style
48+
containerStyle: ViewPropTypes.style,
49+
/**
50+
* Used as a testing identifier
51+
*/
52+
testID: PropTypes.string
4953
};
5054

5155
static defaultProps = {
@@ -103,7 +107,7 @@ export default class AnimatedScanner extends BaseComponent {
103107
}
104108

105109
render() {
106-
const {opacity, backgroundColor, hideScannerLine, style, containerStyle} = this.props;
110+
const {opacity, backgroundColor, hideScannerLine, style, containerStyle, testID} = this.props;
107111
const {isDone, animatedProgress} = this.state;
108112

109113
return (
@@ -121,6 +125,7 @@ export default class AnimatedScanner extends BaseComponent {
121125
})
122126
}
123127
]}
128+
testID={testID}
124129
>
125130
{isDone && !hideScannerLine && <View style={this.styles.scanner}/>}
126131
</Animated.View>

0 commit comments

Comments
 (0)