mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-14 11:53:49 +00:00
fix: prevent presets losing params
This commit is contained in:
committed by
Carlos Valente
parent
6268e327b9
commit
5be504ce8f
@@ -83,7 +83,7 @@ describe('getRouteFromPreset()', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('cuesheet preset options', () => {
|
||||
describe('cuesheet presets', () => {
|
||||
const cuesheetPreset: URLPreset[] = [
|
||||
{
|
||||
enabled: true,
|
||||
@@ -96,6 +96,22 @@ describe('getRouteFromPreset()', () => {
|
||||
},
|
||||
},
|
||||
];
|
||||
const cuesheetPresetWithoutOptions: URLPreset[] = [
|
||||
{
|
||||
enabled: true,
|
||||
alias: 'cuesheet-basic',
|
||||
target: OntimeView.Cuesheet,
|
||||
search: '',
|
||||
},
|
||||
];
|
||||
const cuesheetPresetWithNavLock: URLPreset[] = [
|
||||
{
|
||||
enabled: true,
|
||||
alias: 'cuesheet-locked',
|
||||
target: OntimeView.Cuesheet,
|
||||
search: 'n=1',
|
||||
},
|
||||
];
|
||||
|
||||
it('keeps cuesheet aliases masked when permissions are stored in preset options', () => {
|
||||
const location = resolvePath('/cuesheet-4685d6');
|
||||
@@ -106,6 +122,16 @@ describe('getRouteFromPreset()', () => {
|
||||
const location = resolvePath('/cuesheet-4685d6?n=1&token=123');
|
||||
expect(getRouteFromPreset(location, cuesheetPreset)).toBe('preset/cuesheet-4685d6?n=1&token=123');
|
||||
});
|
||||
|
||||
it('keeps cuesheet aliases masked even when preset options are absent', () => {
|
||||
const location = resolvePath('/cuesheet-basic');
|
||||
expect(getRouteFromPreset(location, cuesheetPresetWithoutOptions)).toBe('preset/cuesheet-basic');
|
||||
});
|
||||
|
||||
it('applies navigation lock from preset search params when alias is opened', () => {
|
||||
const location = resolvePath('/cuesheet-locked');
|
||||
expect(getRouteFromPreset(location, cuesheetPresetWithNavLock)).toBe('preset/cuesheet-locked?n=1');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user