fix: close phase 2 journey blockers
This commit is contained in:
@@ -7,6 +7,7 @@ import {
|
||||
type AdaptiveQualityController,
|
||||
type QualityDecision,
|
||||
} from '@/journey/adaptive-quality';
|
||||
import type { QualityTier } from '@/journey/motion-policy';
|
||||
|
||||
afterEach(() => {
|
||||
vi.restoreAllMocks();
|
||||
@@ -265,6 +266,26 @@ describe('useAdaptiveQuality', () => {
|
||||
expect(wrapper.vm.snapshot.epoch).toBeNull();
|
||||
expect(documentRemove).toHaveBeenCalledWith('visibilitychange', expect.any(Function), { passive: true });
|
||||
});
|
||||
|
||||
it('never lets a visitor request bypass the device-resolved maximum', async () => {
|
||||
const { useAdaptiveQuality } = await import('@/composables/useAdaptiveQuality');
|
||||
Object.defineProperty(document, 'visibilityState', {
|
||||
configurable: true,
|
||||
value: 'visible',
|
||||
});
|
||||
const maximum = ref<QualityTier>('low');
|
||||
const sceneState = ref('running');
|
||||
const pageLifecycle = ref<'active'>('active');
|
||||
const wrapper = mount(defineComponent({
|
||||
setup: () => useAdaptiveQuality({ maximum, sceneState, pageLifecycle, now: () => 0 }),
|
||||
template: '<output />',
|
||||
}));
|
||||
|
||||
expect(wrapper.vm.setMaximum('high', 'manual')).toBeNull();
|
||||
expect(wrapper.vm.snapshot).toMatchObject({ maximum: 'low', actual: 'low' });
|
||||
|
||||
wrapper.unmount();
|
||||
});
|
||||
});
|
||||
|
||||
function feedWindow(
|
||||
|
||||
Reference in New Issue
Block a user