How to use the @testing-library/vue.fireEvent.blur function in @testing-library/vue

To help you get started, we’ve selected a few @testing-library/vue examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github testing-library / user-event / __tests__ / vue / type.js View on Github external
expect(getByTestId("input")).not.toHaveProperty("value", text);

    for (let i = 0; i < text.length; i++) {
      jest.advanceTimersByTime(delay);

      await wait(() => expect(input).toHaveBeenCalledTimes(i + 1));

      expect(getByTestId("input")).toHaveProperty(
        "value",
        text.slice(0, i + 1)
      );
    }

    // Vue's change event is not emitted until blurring the input
    expect(change).not.toHaveBeenCalled();
    fireEvent.blur(getByTestId("input"));
    await wait(() => expect(change).toHaveBeenCalledTimes(1));
  });