You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@ph-fritsche - Would it be possible to add an advance option to type?
The typeImpl function could then call that with the delay before await ing on the promise.
As an example of the approach, I'm using this "wrapper" around type (it only works for plaintext):
async function typeWithDelay(input, text, delayInMilliseconds) {
let previous = Promise.resolve();
for (const codepoint of text) {
await previous;
userEvent.type(input, codepoint);
previous = new Promise((resolve) => setTimeout(() => resolve(), delayInMilliseconds));
act(() => {
jest.advanceTimersByTime(delayInMilliseconds);
});
}
}
So instead of above, I could just call userEvent.type(input, 'some text', { delay: 20, advance: jest.advanceTimersByTime });
@ph-fritsche - Would it be possible to add an
advance
option to type?The typeImpl function could then call that with the delay before
await
ing on the promise.As an example of the approach, I'm using this "wrapper" around type (it only works for plaintext):
So instead of above, I could just call
userEvent.type(input, 'some text', { delay: 20, advance: jest.advanceTimersByTime });
Originally posted by @icedtoast in #565 (comment)
The text was updated successfully, but these errors were encountered: