Skip to content

SectionWheelPicker driver to take testIDs from children #2949

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Apr 24, 2024
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
import _ from 'lodash';
import {useComponentDriver, ComponentProps} from '../../testkit/new/Component.driver';
import {WheelPickerDriver} from '../WheelPicker/WheelPicker.driver';
import {WheelPickerItemValue} from '../WheelPicker';
import {SectionsWheelPickerProps} from './index';

export const SectionsWheelPickerDriver = <T extends WheelPickerItemValue>(props: ComponentProps) => {
export const SectionsWheelPickerDriver = (props: ComponentProps) => {
const driver = useComponentDriver(props);
const sections = driver.getElement().children as SectionsWheelPickerProps<T>;
const sectionsDrivers = _.map(sections, (_, index) => {
const sections = driver.getElement().children as SectionsWheelPickerProps['sections'];
const sectionsDrivers = _.map(sections, (section, index) => {
const sectionTestID = `${props.testID}.${index}`;
return WheelPickerDriver({
renderTree: props.renderTree,
testID: sectionTestID
testID: section?.testID || sectionTestID
});
});




return {...driver, sections, sectionsDrivers};
};