react-select-event icon indicating copy to clipboard operation
react-select-event copied to clipboard

clearFirst seems to clear all?

Open antipalindrome opened this issue 3 years ago • 0 comments

I'm using aisMulti=true Creatable amd writing tests for it.

In my tests I have the following expects:

    expect(value).toEqual([emails[0]]); // Passes
    await selectEvent.select(getByLabelText("To:"), emails[1].label);
    expect(value).toEqual([emails[0], emails[1]]); // Passes
    await selectEvent.clearFirst(getByLabelText("To:"));
    expect(value).toEqual([emails[1]]); // Fails

Which fails like so:

    expect(received).toEqual(expected) // deep equality

    - Expected  - 6
    + Received  + 1

    - Array [
    -   Object {
    -     "label": "Howell Beier",
    -     "value": "[email protected]",
    -   },
    - ]
    + Array []

I would expect this to only clear the very first value from the select, rather than all of them. Or am I misunderstanding something?

antipalindrome avatar Oct 21 '20 19:10 antipalindrome