Skip to content

Commit

Permalink
2.6.3
Browse files Browse the repository at this point in the history
  • Loading branch information
rschristian committed May 27, 2024
1 parent e27fa66 commit 1a45392
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "preact-iso",
"version": "2.6.2",
"version": "2.6.3",
"type": "module",
"main": "src/index.js",
"module": "src/index.js",
Expand Down Expand Up @@ -49,4 +49,4 @@
"preact": "10.15.1",
"preact-render-to-string": "^6.4.0"
}
}
}
32 changes: 32 additions & 0 deletions test/router.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -789,6 +789,38 @@ describe('Router', () => {
expect(params).toMatchObject({ id: 'bar' });
});

it('should append params in nested routes', async () => {
let path, params;
const Inner = () => html`
<${Router}>
<${Route}
path="/:bar/:baz"
component=${() => {
({ path, params } = useRoute());
return null;
}}
/>
<//>
`;

render(
html`
<${LocationProvider}>
<${Router}>
<${Route} path="/foo/*" component=${Inner} />
<//>
<a href="/foo/bar/bob"></a>
<//>
`,
scratch
);

scratch.querySelector('a[href="/foo/bar/bob"]').click();
await sleep(20);
console.log(path);
expect(params).toMatchObject({ id: 'bar' });
});

it('should replace the current URL', async () => {
const pushState = jest.spyOn(history, 'pushState');
const replaceState = jest.spyOn(history, 'replaceState');
Expand Down

0 comments on commit 1a45392

Please sign in to comment.