", () => {
- const events = [];
- const eventsHandler = jest.fn((evt) => events.push(evt.type));
- const { getByTestId } = render({
- render: function (h) {
- return h("div", {
- attrs: {
- "data-testid": "div",
- },
- on: {
- mouseover: eventsHandler,
- mousemove: eventsHandler,
- mousedown: eventsHandler,
- focus: eventsHandler,
- mouseup: eventsHandler,
- click: eventsHandler,
- change: eventsHandler,
- },
- });
- },
- });
-
- userEvent.dblClick(getByTestId("div"));
- expect(events).toEqual([
- "mouseover",
- "mousemove",
- "mousedown",
- "mouseup",
- "click",
- "mousedown",
- "mouseup",
- "click",
- ]);
- });
-});
diff --git a/__tests__/vue/selectoptions.js b/__tests__/vue/selectoptions.js
deleted file mode 100644
index 64a2c824..00000000
--- a/__tests__/vue/selectoptions.js
+++ /dev/null
@@ -1,254 +0,0 @@
-import { render, cleanup } from "@testing-library/vue";
-import "@testing-library/jest-dom/extend-expect";
-import userEvent from "../../src";
-
-afterEach(cleanup);
-
-describe("userEvent.selectOptions", () => {
- it.each(["select", "select multiple"])(
- "should fire the correct events for <%s>",
- (type) => {
- const events = [];
- const eventsHandler = jest.fn((evt) => events.push(evt.type));
- const multiple = type === "select multiple";
- const eventHandlers = {
- mouseover: eventsHandler,
- mousemove: eventsHandler,
- mousedown: eventsHandler,
- focus: eventsHandler,
- mouseup: eventsHandler,
- click: eventsHandler,
- };
-
- const { getByTestId } = render({
- render: function (h) {
- return h(
- "select",
- {
- attrs: {
- "data-testid": "element",
- ...(multiple && { multiple: true }),
- },
- on: eventHandlers,
- },
- [
- h("option", { attrs: { value: "1" } }, "1"),
- h("option", { attrs: { value: "2" } }, "2"),
- h("option", { attrs: { value: "3" } }, "3"),
- ]
- );
- },
- });
-
- userEvent.selectOptions(getByTestId("element"), "1");
-
- expect(events).toEqual([
- "mouseover",
- "mousemove",
- "mousedown",
- "focus",
- "mouseup",
- "click",
- "mouseover", // The events repeat because we click on the child OPTION too
- "mousemove", // But these specifically are the events bubbling up to the