Skip to content

Commit c2eee8f

Browse files
authored
added handling for custom testid in the sections (#3193)
1 parent 9c31199 commit c2eee8f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/components/sectionsWheelPicker/SectionsWheelPicker.driver.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
import _ from 'lodash';
2+
import type {ReactTestInstance} from 'react-test-renderer';
23
import {useComponentDriver, ComponentProps} from '../../testkit/new/Component.driver';
34
import {WheelPickerDriver} from '../WheelPicker/WheelPicker.driver';
4-
import {SectionsWheelPickerProps} from './index';
5+
import type {SectionsWheelPickerProps} from './index';
56

67
export const SectionsWheelPickerDriver = (props: ComponentProps) => {
78
const driver = useComponentDriver(props);
8-
const sections = driver.getElement().children as SectionsWheelPickerProps['sections'];
9+
const sections = _.map(driver.getElement().children as ReactTestInstance[], (child) => child.props) as SectionsWheelPickerProps['sections'];
910
const sectionsDrivers = _.map(sections, (section, index) => {
1011
const sectionTestID = `${props.testID}.${index}`;
1112
return WheelPickerDriver({
1213
renderTree: props.renderTree,
13-
testID: section?.testID || sectionTestID
14+
testID: section.testID || sectionTestID
1415
});
1516
});
1617
return {...driver, sections, sectionsDrivers};

0 commit comments

Comments
 (0)