Skip to content

Commit 32ce30a

Browse files
committed
chore: add query params back test
1 parent faf5e9e commit 32ce30a

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/app/tests/ns-location-strategy.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,22 @@ describe("NSLocationStrategy", () => {
270270
assert.equal(popCount, 0); // no onPopState when replacing
271271
});
272272

273+
it("back() preserves query params", () => {
274+
const { strategy } = initStrategy("/?param=1");
275+
let popCount = 0;
276+
strategy.onPopState(() => {
277+
popCount++;
278+
});
279+
280+
strategy.pushState(null, "test", "/test", null);
281+
assert.equal(strategy.path(), "/test");
282+
assert.equal(popCount, 0);
283+
284+
strategy.back();
285+
assert.equal(strategy.path(), "/?param=1");
286+
assert.equal(popCount, 1);
287+
});
288+
273289
it("pushState() with page navigation", () => {
274290
const { strategy } = initStrategy("/");
275291
const outletName = "primary";

0 commit comments

Comments
 (0)