test: reproduce NumberField typing regression within one task
This commit is contained in:
@@ -202,9 +202,13 @@ describe("NumberField public contracts", () => {
|
|||||||
["9", "49"],
|
["9", "49"],
|
||||||
["0", "490"],
|
["0", "490"],
|
||||||
] as const) {
|
] as const) {
|
||||||
await input.trigger("keydown", { key });
|
// Keep keydown and text insertion in one task: awaiting trigger() here
|
||||||
await input.setValue(text);
|
// would flush the old nextTick(restore) before typing and hide the bug.
|
||||||
await input.trigger("input");
|
input.element.dispatchEvent(
|
||||||
|
new KeyboardEvent("keydown", { key, bubbles: true, cancelable: true }),
|
||||||
|
);
|
||||||
|
(input.element as HTMLInputElement).value = text;
|
||||||
|
input.element.dispatchEvent(new Event("input", { bubbles: true }));
|
||||||
await nextTick();
|
await nextTick();
|
||||||
await nextTick();
|
await nextTick();
|
||||||
expect((input.element as HTMLInputElement).value).toBe(text);
|
expect((input.element as HTMLInputElement).value).toBe(text);
|
||||||
|
|||||||
Reference in New Issue
Block a user