This commit is contained in:
@@ -2,6 +2,12 @@ import { describe, expect, it } from 'vitest';
|
||||
import { contextHref, returnLabel, safeReturnHref } from '../../src/lib/navigation-context.js';
|
||||
|
||||
describe('navigation context', () => {
|
||||
it('restores Bank filters, pagination and the selected player from detail pages', () => {
|
||||
const source = '/bank?view=transactions&game=t5&offset=25&player=00042&historyOffset=25';
|
||||
const target = new URL(contextHref('/matches/17', source), 'http://localhost');
|
||||
expect(safeReturnHref(target.searchParams.get('returnTo'), '/')).toBe(source);
|
||||
expect(returnLabel(source)).toBe('Back to Bank');
|
||||
});
|
||||
it('retains nested origins, list scope, loaded results and anchors', () => {
|
||||
const source = new URL(
|
||||
'http://localhost/leaderboard/players/42?game=t5&offset=25&returnTo=%2Fleaderboard%3Fq%3DAce#history-title'
|
||||
|
||||
Reference in New Issue
Block a user