Fix FE
This commit is contained in:
parent
1241132095
commit
54a5c3ca9a
28 changed files with 826 additions and 422 deletions
|
|
@ -352,8 +352,8 @@ describe('url-state', () => {
|
|||
});
|
||||
|
||||
it('round-trips repeated school filters with dedicated URL params', () => {
|
||||
const schoolOne = createSchoolFilterKey('primary', 'good', 2, 1);
|
||||
const schoolTwo = createSchoolFilterKey('secondary', 'outstanding', 5, 2);
|
||||
const schoolOne = createSchoolFilterKey('primary', 'good', 1);
|
||||
const schoolTwo = createSchoolFilterKey('secondary', 'outstanding', 2);
|
||||
|
||||
const params = stateToParams(
|
||||
null,
|
||||
|
|
@ -366,18 +366,22 @@ describe('url-state', () => {
|
|||
'area'
|
||||
);
|
||||
|
||||
expect(params.getAll('school')).toEqual([
|
||||
'primary:good:2:1:10',
|
||||
'secondary:outstanding:5:2:15',
|
||||
]);
|
||||
expect(params.getAll('school')).toEqual(['primary:good:1:10', 'secondary:outstanding:2:15']);
|
||||
expect(params.getAll('filter')).toEqual([]);
|
||||
|
||||
window.history.replaceState({}, '', `/?${params.toString()}`);
|
||||
const state = parseUrlState();
|
||||
|
||||
expect(state.filters).toEqual({
|
||||
[createSchoolFilterKey('primary', 'good', 2, 0)]: [1, 10],
|
||||
[createSchoolFilterKey('secondary', 'outstanding', 5, 1)]: [2, 15],
|
||||
[createSchoolFilterKey('primary', 'good', 0)]: [1, 10],
|
||||
[createSchoolFilterKey('secondary', 'outstanding', 1)]: [2, 15],
|
||||
});
|
||||
});
|
||||
|
||||
it('parses legacy school URL params that still carry a distance segment', () => {
|
||||
window.history.replaceState({}, '', '/?school=primary%3Agood%3A2%3A1%3A10');
|
||||
expect(parseUrlState().filters).toEqual({
|
||||
[createSchoolFilterKey('primary', 'good', 0)]: [1, 10],
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue