@testing-library/user-event 10.3.2 → 10.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/LICENSE +2 -3
- package/README.md +201 -107
- package/dist/index.js +326 -252
- package/package.json +42 -43
- package/typings/index.d.ts +24 -20
- package/.all-contributorsrc +0 -311
- package/.babelrc +0 -13
- package/.gitattributes +0 -1
- package/.nvmrc +0 -1
- package/.prettierrc.js +0 -3
- package/.travis.yml +0 -30
- package/__tests__/react/clear.js +0 -94
- package/__tests__/react/click.js +0 -437
- package/__tests__/react/dblclick.js +0 -211
- package/__tests__/react/selectoptions.js +0 -282
- package/__tests__/react/tab.js +0 -277
- package/__tests__/react/type.js +0 -265
- package/__tests__/react/upload.js +0 -124
- package/__tests__/vue/click.js +0 -342
- package/__tests__/vue/dblclick.js +0 -126
- package/__tests__/vue/selectoptions.js +0 -254
- package/__tests__/vue/type.js +0 -240
- package/lint-staged.config.js +0 -21
- package/other/dog.png +0 -0
- package/src/index.js +0 -373
|
@@ -1,254 +0,0 @@
|
|
|
1
|
-
import { render, cleanup } from "@testing-library/vue";
|
|
2
|
-
import "@testing-library/jest-dom/extend-expect";
|
|
3
|
-
import userEvent from "../../src";
|
|
4
|
-
|
|
5
|
-
afterEach(cleanup);
|
|
6
|
-
|
|
7
|
-
describe("userEvent.selectOptions", () => {
|
|
8
|
-
it.each(["select", "select multiple"])(
|
|
9
|
-
"should fire the correct events for <%s>",
|
|
10
|
-
(type) => {
|
|
11
|
-
const events = [];
|
|
12
|
-
const eventsHandler = jest.fn((evt) => events.push(evt.type));
|
|
13
|
-
const multiple = type === "select multiple";
|
|
14
|
-
const eventHandlers = {
|
|
15
|
-
mouseover: eventsHandler,
|
|
16
|
-
mousemove: eventsHandler,
|
|
17
|
-
mousedown: eventsHandler,
|
|
18
|
-
focus: eventsHandler,
|
|
19
|
-
mouseup: eventsHandler,
|
|
20
|
-
click: eventsHandler,
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
const { getByTestId } = render({
|
|
24
|
-
render: function (h) {
|
|
25
|
-
return h(
|
|
26
|
-
"select",
|
|
27
|
-
{
|
|
28
|
-
attrs: {
|
|
29
|
-
"data-testid": "element",
|
|
30
|
-
...(multiple && { multiple: true }),
|
|
31
|
-
},
|
|
32
|
-
on: eventHandlers,
|
|
33
|
-
},
|
|
34
|
-
[
|
|
35
|
-
h("option", { attrs: { value: "1" } }, "1"),
|
|
36
|
-
h("option", { attrs: { value: "2" } }, "2"),
|
|
37
|
-
h("option", { attrs: { value: "3" } }, "3"),
|
|
38
|
-
]
|
|
39
|
-
);
|
|
40
|
-
},
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
userEvent.selectOptions(getByTestId("element"), "1");
|
|
44
|
-
|
|
45
|
-
expect(events).toEqual([
|
|
46
|
-
"mouseover",
|
|
47
|
-
"mousemove",
|
|
48
|
-
"mousedown",
|
|
49
|
-
"focus",
|
|
50
|
-
"mouseup",
|
|
51
|
-
"click",
|
|
52
|
-
"mouseover", // The events repeat because we click on the child OPTION too
|
|
53
|
-
"mousemove", // But these specifically are the events bubbling up to the <select>
|
|
54
|
-
"mousedown",
|
|
55
|
-
// "focus", // Focus event isn't being emitted?
|
|
56
|
-
"mouseup",
|
|
57
|
-
"click",
|
|
58
|
-
]);
|
|
59
|
-
}
|
|
60
|
-
);
|
|
61
|
-
|
|
62
|
-
it("should fire the correct events on selected OPTION child with <select>", () => {
|
|
63
|
-
function handleEvent(evt) {
|
|
64
|
-
const optValue = parseInt(evt.target.value);
|
|
65
|
-
events[optValue] = [...(events[optValue] || []), evt.type];
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const events = [];
|
|
69
|
-
const eventsHandler = jest.fn(handleEvent);
|
|
70
|
-
const eventHandlers = {
|
|
71
|
-
mouseover: eventsHandler,
|
|
72
|
-
mousemove: eventsHandler,
|
|
73
|
-
mousedown: eventsHandler,
|
|
74
|
-
focus: eventsHandler,
|
|
75
|
-
mouseup: eventsHandler,
|
|
76
|
-
click: eventsHandler,
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
const { getByTestId } = render({
|
|
80
|
-
render: function (h) {
|
|
81
|
-
return h(
|
|
82
|
-
"select",
|
|
83
|
-
{
|
|
84
|
-
attrs: {
|
|
85
|
-
"data-testid": "element",
|
|
86
|
-
},
|
|
87
|
-
},
|
|
88
|
-
[
|
|
89
|
-
h("option", { attrs: { value: "1" }, on: eventHandlers }, "1"),
|
|
90
|
-
h("option", { attrs: { value: "2" }, on: eventHandlers }, "2"),
|
|
91
|
-
h("option", { attrs: { value: "3" }, on: eventHandlers }, "3"),
|
|
92
|
-
]
|
|
93
|
-
);
|
|
94
|
-
},
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
userEvent.selectOptions(getByTestId("element"), ["2"]);
|
|
98
|
-
|
|
99
|
-
expect(events[1]).toBe(undefined);
|
|
100
|
-
expect(events[3]).toBe(undefined);
|
|
101
|
-
expect(events[2]).toEqual([
|
|
102
|
-
"mouseover",
|
|
103
|
-
"mousemove",
|
|
104
|
-
"mousedown",
|
|
105
|
-
"focus",
|
|
106
|
-
"mouseup",
|
|
107
|
-
"click",
|
|
108
|
-
]);
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
it("should fire the correct events on selected OPTION children with <select multiple>", () => {
|
|
112
|
-
function handleEvent(evt) {
|
|
113
|
-
const optValue = parseInt(evt.target.value);
|
|
114
|
-
events[optValue] = [...(events[optValue] || []), evt.type];
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
const events = [];
|
|
118
|
-
const eventsHandler = jest.fn(handleEvent);
|
|
119
|
-
const eventHandlers = {
|
|
120
|
-
mouseover: eventsHandler,
|
|
121
|
-
mousemove: eventsHandler,
|
|
122
|
-
mousedown: eventsHandler,
|
|
123
|
-
focus: eventsHandler,
|
|
124
|
-
mouseup: eventsHandler,
|
|
125
|
-
click: eventsHandler,
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
const { getByTestId } = render({
|
|
129
|
-
render: function (h) {
|
|
130
|
-
return h(
|
|
131
|
-
"select",
|
|
132
|
-
{
|
|
133
|
-
attrs: {
|
|
134
|
-
"data-testid": "element",
|
|
135
|
-
multiple: true,
|
|
136
|
-
},
|
|
137
|
-
},
|
|
138
|
-
[
|
|
139
|
-
h("option", { attrs: { value: "1" }, on: eventHandlers }, "1"),
|
|
140
|
-
h("option", { attrs: { value: "2" }, on: eventHandlers }, "2"),
|
|
141
|
-
h("option", { attrs: { value: "3" }, on: eventHandlers }, "3"),
|
|
142
|
-
]
|
|
143
|
-
);
|
|
144
|
-
},
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
userEvent.selectOptions(getByTestId("element"), ["1", "3"]);
|
|
148
|
-
|
|
149
|
-
expect(events[2]).toBe(undefined);
|
|
150
|
-
expect(events[1]).toEqual([
|
|
151
|
-
"mouseover",
|
|
152
|
-
"mousemove",
|
|
153
|
-
"mousedown",
|
|
154
|
-
"focus",
|
|
155
|
-
"mouseup",
|
|
156
|
-
"click",
|
|
157
|
-
]);
|
|
158
|
-
|
|
159
|
-
expect(events[3]).toEqual([
|
|
160
|
-
"mouseover",
|
|
161
|
-
"mousemove",
|
|
162
|
-
"mousedown",
|
|
163
|
-
"focus",
|
|
164
|
-
"mouseup",
|
|
165
|
-
"click",
|
|
166
|
-
]);
|
|
167
|
-
});
|
|
168
|
-
|
|
169
|
-
it("sets the selected prop on the selected OPTION", () => {
|
|
170
|
-
const { getByTestId } = render({
|
|
171
|
-
template: `
|
|
172
|
-
<form>
|
|
173
|
-
<select data-testid="element" multiple>
|
|
174
|
-
<option value="1" data-testid="val1">1</option>
|
|
175
|
-
<option value="2" data-testid="val2">2</option>
|
|
176
|
-
<option value="3" data-testid="val3">3</option>
|
|
177
|
-
</select>
|
|
178
|
-
</form>`,
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
userEvent.selectOptions(getByTestId("element"), ["1", "3"]);
|
|
182
|
-
|
|
183
|
-
expect(getByTestId("val1").selected).toBe(true);
|
|
184
|
-
expect(getByTestId("val2").selected).toBe(false);
|
|
185
|
-
expect(getByTestId("val3").selected).toBe(true);
|
|
186
|
-
});
|
|
187
|
-
|
|
188
|
-
it("sets the selected prop on the selected OPTION using htmlFor", () => {
|
|
189
|
-
const { getByTestId } = render({
|
|
190
|
-
template: `
|
|
191
|
-
<form>
|
|
192
|
-
<label htmlFor="select">Example Select</label>
|
|
193
|
-
<select id="select" data-testid="element">
|
|
194
|
-
<option data-testid="val1" value="1">1</option>
|
|
195
|
-
<option data-testid="val2" value="2">2</option>
|
|
196
|
-
<option data-testid="val3" value="3">3</option>
|
|
197
|
-
</select>
|
|
198
|
-
</form>`,
|
|
199
|
-
});
|
|
200
|
-
|
|
201
|
-
userEvent.selectOptions(getByTestId("element"), "2");
|
|
202
|
-
|
|
203
|
-
expect(getByTestId("val1").selected).toBe(false);
|
|
204
|
-
expect(getByTestId("val2").selected).toBe(true);
|
|
205
|
-
expect(getByTestId("val3").selected).toBe(false);
|
|
206
|
-
});
|
|
207
|
-
|
|
208
|
-
it("sets the selected prop on the selected OPTION using nested SELECT", () => {
|
|
209
|
-
const { getByTestId } = render({
|
|
210
|
-
template: `
|
|
211
|
-
<form>
|
|
212
|
-
<label>
|
|
213
|
-
Example Select
|
|
214
|
-
<select data-testid="element">
|
|
215
|
-
<option data-testid="val1" value="1">1</option>
|
|
216
|
-
<option data-testid="val2" value="2">2</option>
|
|
217
|
-
<option data-testid="val3" value="3">3</option>
|
|
218
|
-
</select>
|
|
219
|
-
</label>
|
|
220
|
-
</form>`,
|
|
221
|
-
});
|
|
222
|
-
|
|
223
|
-
userEvent.selectOptions(getByTestId("element"), "2");
|
|
224
|
-
|
|
225
|
-
expect(getByTestId("val1").selected).toBe(false);
|
|
226
|
-
expect(getByTestId("val2").selected).toBe(true);
|
|
227
|
-
expect(getByTestId("val3").selected).toBe(false);
|
|
228
|
-
});
|
|
229
|
-
|
|
230
|
-
it("sets the selected prop on the selected OPTION using OPTGROUPS", () => {
|
|
231
|
-
const { getByTestId } = render({
|
|
232
|
-
template: `
|
|
233
|
-
<form>
|
|
234
|
-
<select data-testid="element" multiple>
|
|
235
|
-
<optgroup label="test optgroup 1">
|
|
236
|
-
<option value="1" data-testid="val1">1</option>
|
|
237
|
-
</optgroup>
|
|
238
|
-
<optgroup label="test optgroup 2">
|
|
239
|
-
<option value="2" data-testid="val2">2</option>
|
|
240
|
-
</optgroup>
|
|
241
|
-
<optgroup label="test optgroup 3">
|
|
242
|
-
<option value="3" data-testid="val3">3</option>
|
|
243
|
-
</optgroup>
|
|
244
|
-
</select>
|
|
245
|
-
</form>`,
|
|
246
|
-
});
|
|
247
|
-
|
|
248
|
-
userEvent.selectOptions(getByTestId("element"), ["1", "3"]);
|
|
249
|
-
|
|
250
|
-
expect(getByTestId("val1").selected).toBe(true);
|
|
251
|
-
expect(getByTestId("val2").selected).toBe(false);
|
|
252
|
-
expect(getByTestId("val3").selected).toBe(true);
|
|
253
|
-
});
|
|
254
|
-
});
|
package/__tests__/vue/type.js
DELETED
|
@@ -1,240 +0,0 @@
|
|
|
1
|
-
import { cleanup, render, wait, fireEvent } from "@testing-library/vue";
|
|
2
|
-
import "@testing-library/jest-dom/extend-expect";
|
|
3
|
-
import userEvent from "../../src";
|
|
4
|
-
|
|
5
|
-
afterEach(cleanup);
|
|
6
|
-
|
|
7
|
-
const renderComponent = (type, events = {}, attrs = {}) =>
|
|
8
|
-
render({
|
|
9
|
-
render: function (h) {
|
|
10
|
-
return h(type, {
|
|
11
|
-
attrs: { "data-testid": "input", ...attrs },
|
|
12
|
-
on: events,
|
|
13
|
-
});
|
|
14
|
-
},
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
describe("userEvent.type", () => {
|
|
18
|
-
it.each(["input", "textarea"])("should type text in <%s>", (type) => {
|
|
19
|
-
const input = jest.fn();
|
|
20
|
-
|
|
21
|
-
const { getByTestId } = renderComponent(type, { input });
|
|
22
|
-
|
|
23
|
-
const text = "Hello, world!";
|
|
24
|
-
userEvent.type(getByTestId("input"), text);
|
|
25
|
-
|
|
26
|
-
expect(input).toHaveBeenCalledTimes(text.length);
|
|
27
|
-
expect(getByTestId("input")).toHaveProperty("value", text);
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
it("should not type when event.preventDefault() is called", () => {
|
|
31
|
-
const input = jest.fn();
|
|
32
|
-
const change = jest.fn();
|
|
33
|
-
const keydown = jest
|
|
34
|
-
.fn()
|
|
35
|
-
.mockImplementation((event) => event.preventDefault());
|
|
36
|
-
|
|
37
|
-
const { getByTestId } = renderComponent("input", {
|
|
38
|
-
input,
|
|
39
|
-
keydown,
|
|
40
|
-
change,
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
const text = "Hello, world!";
|
|
44
|
-
userEvent.type(getByTestId("input"), text);
|
|
45
|
-
expect(keydown).toHaveBeenCalledTimes(text.length);
|
|
46
|
-
expect(change).toHaveBeenCalledTimes(0);
|
|
47
|
-
expect(input).toHaveBeenCalledTimes(0);
|
|
48
|
-
expect(getByTestId("input")).not.toHaveProperty("value", text);
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
it.each(["input", "textarea"])(
|
|
52
|
-
"should not type when <%s> is disabled",
|
|
53
|
-
(type) => {
|
|
54
|
-
const change = jest.fn();
|
|
55
|
-
const { getByTestId } = renderComponent(
|
|
56
|
-
type,
|
|
57
|
-
{
|
|
58
|
-
change,
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
disabled: true,
|
|
62
|
-
}
|
|
63
|
-
);
|
|
64
|
-
const text = "Hello, world!";
|
|
65
|
-
userEvent.type(getByTestId("input"), text);
|
|
66
|
-
expect(change).not.toHaveBeenCalled();
|
|
67
|
-
expect(getByTestId("input")).toHaveProperty("value", "");
|
|
68
|
-
}
|
|
69
|
-
);
|
|
70
|
-
|
|
71
|
-
it.each(["input", "textarea"])(
|
|
72
|
-
"should not type when <%s> is readOnly",
|
|
73
|
-
(type) => {
|
|
74
|
-
const change = jest.fn();
|
|
75
|
-
const keydown = jest.fn();
|
|
76
|
-
const keypress = jest.fn();
|
|
77
|
-
const keyup = jest.fn();
|
|
78
|
-
const { getByTestId } = renderComponent(
|
|
79
|
-
type,
|
|
80
|
-
{
|
|
81
|
-
change,
|
|
82
|
-
keydown,
|
|
83
|
-
keypress,
|
|
84
|
-
keyup,
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
readOnly: true,
|
|
88
|
-
}
|
|
89
|
-
);
|
|
90
|
-
const text = "Hello, world!";
|
|
91
|
-
userEvent.type(getByTestId("input"), text);
|
|
92
|
-
expect(keydown).toHaveBeenCalledTimes(text.length);
|
|
93
|
-
expect(keypress).toHaveBeenCalledTimes(text.length);
|
|
94
|
-
expect(keyup).toHaveBeenCalledTimes(text.length);
|
|
95
|
-
expect(change).not.toHaveBeenCalled();
|
|
96
|
-
expect(getByTestId("input")).toHaveProperty("value", "");
|
|
97
|
-
}
|
|
98
|
-
);
|
|
99
|
-
|
|
100
|
-
it("should delay the typing when opts.delay is not 0", async () => {
|
|
101
|
-
jest.useFakeTimers();
|
|
102
|
-
const change = jest.fn();
|
|
103
|
-
const input = jest.fn();
|
|
104
|
-
const { getByTestId } = renderComponent("input", { change, input });
|
|
105
|
-
const text = "Hello, world!";
|
|
106
|
-
const delay = 10;
|
|
107
|
-
|
|
108
|
-
userEvent.type(getByTestId("input"), text, {
|
|
109
|
-
delay,
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
expect(input).not.toHaveBeenCalled();
|
|
113
|
-
expect(getByTestId("input")).not.toHaveProperty("value", text);
|
|
114
|
-
|
|
115
|
-
for (let i = 0; i < text.length; i++) {
|
|
116
|
-
jest.advanceTimersByTime(delay);
|
|
117
|
-
|
|
118
|
-
await wait(() => expect(input).toHaveBeenCalledTimes(i + 1));
|
|
119
|
-
|
|
120
|
-
expect(getByTestId("input")).toHaveProperty(
|
|
121
|
-
"value",
|
|
122
|
-
text.slice(0, i + 1)
|
|
123
|
-
);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
// Vue's change event is not emitted until blurring the input
|
|
127
|
-
expect(change).not.toHaveBeenCalled();
|
|
128
|
-
fireEvent.blur(getByTestId("input"));
|
|
129
|
-
await wait(() => expect(change).toHaveBeenCalledTimes(1));
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
it.each(["input", "textarea"])(
|
|
133
|
-
"should type text in <%s> all at once",
|
|
134
|
-
(type) => {
|
|
135
|
-
const input = jest.fn();
|
|
136
|
-
|
|
137
|
-
const { getByTestId } = renderComponent(type, { input });
|
|
138
|
-
const text = "Hello, world!";
|
|
139
|
-
|
|
140
|
-
userEvent.type(getByTestId("input"), text, {
|
|
141
|
-
allAtOnce: true,
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
expect(getByTestId("input")).toHaveProperty("value", text);
|
|
145
|
-
expect(input).toHaveBeenCalledTimes(1);
|
|
146
|
-
}
|
|
147
|
-
);
|
|
148
|
-
|
|
149
|
-
it.each(["input", "textarea"])(
|
|
150
|
-
"should enter text in <%s> up to maxLength if provided",
|
|
151
|
-
(type) => {
|
|
152
|
-
const input = jest.fn();
|
|
153
|
-
const keydown = jest.fn();
|
|
154
|
-
const keypress = jest.fn();
|
|
155
|
-
const keyup = jest.fn();
|
|
156
|
-
const maxLength = 10;
|
|
157
|
-
|
|
158
|
-
const { getByTestId } = renderComponent(
|
|
159
|
-
type,
|
|
160
|
-
{ input, keydown, keypress, keyup },
|
|
161
|
-
{ maxLength }
|
|
162
|
-
);
|
|
163
|
-
|
|
164
|
-
const text = "superlongtext";
|
|
165
|
-
const slicedText = text.slice(0, maxLength);
|
|
166
|
-
|
|
167
|
-
const inputEl = getByTestId("input");
|
|
168
|
-
|
|
169
|
-
userEvent.type(inputEl, text);
|
|
170
|
-
expect(inputEl).toHaveProperty("value", slicedText);
|
|
171
|
-
expect(keydown).toHaveBeenCalledTimes(text.length);
|
|
172
|
-
expect(keypress).toHaveBeenCalledTimes(text.length);
|
|
173
|
-
expect(keyup).toHaveBeenCalledTimes(text.length);
|
|
174
|
-
|
|
175
|
-
inputEl.value = "";
|
|
176
|
-
input.mockClear();
|
|
177
|
-
keydown.mockClear();
|
|
178
|
-
keypress.mockClear();
|
|
179
|
-
keyup.mockClear();
|
|
180
|
-
|
|
181
|
-
userEvent.type(inputEl, text, {
|
|
182
|
-
allAtOnce: true,
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
expect(inputEl).toHaveProperty("value", slicedText);
|
|
186
|
-
expect(input).toHaveBeenCalledTimes(1);
|
|
187
|
-
expect(keydown).not.toHaveBeenCalled();
|
|
188
|
-
expect(keypress).not.toHaveBeenCalled();
|
|
189
|
-
expect(keyup).not.toHaveBeenCalled();
|
|
190
|
-
}
|
|
191
|
-
);
|
|
192
|
-
|
|
193
|
-
it.each(["input", "textarea"])(
|
|
194
|
-
"should append text in <%s> up to maxLength if provided",
|
|
195
|
-
(type) => {
|
|
196
|
-
const input = jest.fn();
|
|
197
|
-
const keydown = jest.fn();
|
|
198
|
-
const keypress = jest.fn();
|
|
199
|
-
const keyup = jest.fn();
|
|
200
|
-
const maxLength = 10;
|
|
201
|
-
|
|
202
|
-
const { getByTestId } = renderComponent(
|
|
203
|
-
type,
|
|
204
|
-
{ input, keydown, keypress, keyup },
|
|
205
|
-
{ maxLength }
|
|
206
|
-
);
|
|
207
|
-
|
|
208
|
-
const text1 = "superlong";
|
|
209
|
-
const text2 = "text";
|
|
210
|
-
const text = text1 + text2;
|
|
211
|
-
const slicedText = text.slice(0, maxLength);
|
|
212
|
-
|
|
213
|
-
const inputEl = getByTestId("input");
|
|
214
|
-
|
|
215
|
-
userEvent.type(inputEl, text1);
|
|
216
|
-
userEvent.type(inputEl, text2);
|
|
217
|
-
|
|
218
|
-
expect(inputEl).toHaveProperty("value", slicedText);
|
|
219
|
-
expect(keydown).toHaveBeenCalledTimes(text.length);
|
|
220
|
-
expect(keypress).toHaveBeenCalledTimes(text.length);
|
|
221
|
-
expect(keyup).toHaveBeenCalledTimes(text.length);
|
|
222
|
-
|
|
223
|
-
inputEl.value = "";
|
|
224
|
-
input.mockClear();
|
|
225
|
-
keydown.mockClear();
|
|
226
|
-
keypress.mockClear();
|
|
227
|
-
keyup.mockClear();
|
|
228
|
-
|
|
229
|
-
userEvent.type(inputEl, text, {
|
|
230
|
-
allAtOnce: true,
|
|
231
|
-
});
|
|
232
|
-
|
|
233
|
-
expect(inputEl).toHaveProperty("value", slicedText);
|
|
234
|
-
expect(input).toHaveBeenCalledTimes(1);
|
|
235
|
-
expect(keydown).not.toHaveBeenCalled();
|
|
236
|
-
expect(keypress).not.toHaveBeenCalled();
|
|
237
|
-
expect(keyup).not.toHaveBeenCalled();
|
|
238
|
-
}
|
|
239
|
-
);
|
|
240
|
-
});
|
package/lint-staged.config.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
const micromatch = require("micromatch");
|
|
2
|
-
|
|
3
|
-
const IGNORE = [
|
|
4
|
-
"**/package.json",
|
|
5
|
-
"**/package-lock.json",
|
|
6
|
-
"**/node_modules/**",
|
|
7
|
-
"**/dist/**"
|
|
8
|
-
];
|
|
9
|
-
|
|
10
|
-
module.exports = {
|
|
11
|
-
"**/*.{js,json}": files => {
|
|
12
|
-
const match = micromatch.not(files, IGNORE);
|
|
13
|
-
return match.map(filename => `prettier --write '${filename}'`);
|
|
14
|
-
},
|
|
15
|
-
"**/*.md": files => {
|
|
16
|
-
const match = micromatch.not(files, IGNORE);
|
|
17
|
-
return match.map(
|
|
18
|
-
filename => `prettier --write --parser markdown '${filename}'`
|
|
19
|
-
);
|
|
20
|
-
}
|
|
21
|
-
};
|
package/other/dog.png
DELETED
|
Binary file
|