Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion packages/wouter-preact/test/preact.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ describe("Preact support", () => {
);
};

let node = render(<App />, container);
// render inside `act` so that effects run and routes subscribe to location updates
act(() => render(<App />, container));

const routesEl = container.querySelector('[data-testid="routes"]')!;
const indexLinkEl = container.querySelector('[data-testid="index-link"]')!;
Expand Down Expand Up @@ -190,6 +191,12 @@ describe("Preact support", () => {

// Link accepts an `onClick` prop, fired after the navigation
expect(fn).toHaveBeenCalledTimes(1);

// subscribed routes re-render with the new location
expect(routesEl.textContent).toBe("Rolling Stones Best 100 Albums");

act(() => render(null, container));
container.remove();
});
});

Expand Down
Loading