Blocking behaviour while typing fixed + added spinner (#6)

* Some README tweaks

* Next's staticProps blocking beheaviour while typing fixed + Added spinner

* Testing for previous fix

* Faker deprecational update
This commit is contained in:
David
2021-04-01 15:40:25 +02:00
committed by GitHub
parent e60be0663b
commit ea8c1bad57
10 changed files with 677 additions and 571 deletions

View File

@@ -61,7 +61,7 @@ describe("getStaticProps", () => {
describe("Page", () => {
const translationRes = faker.random.words();
const randomAudio = Array.from({ length: 10 }, () => faker.random.number(100));
const randomAudio = Array.from({ length: 10 }, () => faker.datatype.number(100));
const audio = {
source: randomAudio,
target: randomAudio
@@ -84,11 +84,17 @@ describe("Page", () => {
userEvent.type(query, faker.random.words());
await waitFor(
() => expect(Router.push).not.toHaveBeenCalled(),
() => {
expect(Router.push).not.toHaveBeenCalled();
expect(screen.queryByText(/loading translation/i)).not.toBeInTheDocument();
},
{ timeout: 250 }
);
await waitFor(
() => expect(Router.push).toHaveBeenCalledTimes(1),
() => {
expect(Router.push).toHaveBeenCalledTimes(1);
expect(screen.getByText(/loading translation/i)).toBeInTheDocument();
},
{ timeout: 2500 }
);
});