Skip to content

Commit 1a45392

Browse files
committed
2.6.3
1 parent e27fa66 commit 1a45392

File tree

2 files changed

+34
-2
lines changed

2 files changed

+34
-2
lines changed

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "preact-iso",
3-
"version": "2.6.2",
3+
"version": "2.6.3",
44
"type": "module",
55
"main": "src/index.js",
66
"module": "src/index.js",
@@ -49,4 +49,4 @@
4949
"preact": "10.15.1",
5050
"preact-render-to-string": "^6.4.0"
5151
}
52-
}
52+
}

test/router.test.js

+32
Original file line numberDiff line numberDiff line change
@@ -789,6 +789,38 @@ describe('Router', () => {
789789
expect(params).toMatchObject({ id: 'bar' });
790790
});
791791

792+
it('should append params in nested routes', async () => {
793+
let path, params;
794+
const Inner = () => html`
795+
<${Router}>
796+
<${Route}
797+
path="/:bar/:baz"
798+
component=${() => {
799+
({ path, params } = useRoute());
800+
return null;
801+
}}
802+
/>
803+
<//>
804+
`;
805+
806+
render(
807+
html`
808+
<${LocationProvider}>
809+
<${Router}>
810+
<${Route} path="/foo/*" component=${Inner} />
811+
<//>
812+
<a href="/foo/bar/bob"></a>
813+
<//>
814+
`,
815+
scratch
816+
);
817+
818+
scratch.querySelector('a[href="/foo/bar/bob"]').click();
819+
await sleep(20);
820+
console.log(path);
821+
expect(params).toMatchObject({ id: 'bar' });
822+
});
823+
792824
it('should replace the current URL', async () => {
793825
const pushState = jest.spyOn(history, 'pushState');
794826
const replaceState = jest.spyOn(history, 'replaceState');

0 commit comments

Comments
 (0)