Skip to content

fireEvent Cannot read property 'charAt' of undefined #289

@sammysium

Description

@sammysium

Ask your Question

I doubt it is a bug but I have a Picker component and I am the following, trying to fire onValueChange:

const onEventMock = jest.fn();
const {getByTestId} = render();

const picker = getByTestId('TID_Language_Selector');

fireEvent(picker, 'onValueChange', 'ab');
expect(onEventMock).toHaveBeenCalledWith('ab');

It fails with fireEvent Cannot read property 'charAt' of undefined

I already tried fireEvent.onChange(picker) but it has no effect. How can I stimulate onValueChange event?

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions