Skip to content

Commit 579db78

Browse files
authored
SectionWheelPicker driver to take testIDs from children (#2949)
* Changed sections drivers finding * removed main testID from the section testid in the driver * removed extra import * Changed to take testIDs from children * Fixed testId and removed unused variable * formattings * change section type cheking to be mroe readable * changed implementation
1 parent daf43bc commit 579db78

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed
Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,17 @@
11
import _ from 'lodash';
22
import {useComponentDriver, ComponentProps} from '../../testkit/new/Component.driver';
33
import {WheelPickerDriver} from '../WheelPicker/WheelPicker.driver';
4-
import {WheelPickerItemValue} from '../WheelPicker';
54
import {SectionsWheelPickerProps} from './index';
65

7-
export const SectionsWheelPickerDriver = <T extends WheelPickerItemValue>(props: ComponentProps) => {
6+
export const SectionsWheelPickerDriver = (props: ComponentProps) => {
87
const driver = useComponentDriver(props);
9-
const sections = driver.getElement().children as SectionsWheelPickerProps<T>;
10-
const sectionsDrivers = _.map(sections, (_, index) => {
8+
const sections = driver.getElement().children as SectionsWheelPickerProps['sections'];
9+
const sectionsDrivers = _.map(sections, (section, index) => {
1110
const sectionTestID = `${props.testID}.${index}`;
1211
return WheelPickerDriver({
1312
renderTree: props.renderTree,
14-
testID: sectionTestID
13+
testID: section?.testID || sectionTestID
1514
});
1615
});
17-
18-
19-
20-
2116
return {...driver, sections, sectionsDrivers};
2217
};

0 commit comments

Comments
 (0)