fix: Ensure a bare ptz_digital action resets the zoom (#2635)

- Closes: #2632
This commit is contained in:
Dermot Duffy
2026-07-29 23:18:06 -07:00
committed by GitHub
parent e9e6d9f833
commit a736f3dfaf
14 changed files with 258 additions and 113 deletions
+16 -1
View File
@@ -1,7 +1,10 @@
import { vi } from 'vitest';
import { expect, vi } from 'vitest';
import type { CardController } from '../../../src/card-controller/controller';
import { applyViewModifiers } from '../../../src/card-controller/view/modifiers';
import type { ViewManagerInterface } from '../../../src/card-controller/view/types';
import type { RawAdvancedCameraCardConfig } from '../../../src/config/types';
import type { View } from '../../../src/view/view';
import {
createCameraManager,
createCapabilities,
@@ -42,3 +45,15 @@ export const createPopulatedAPI = (
vi.mocked(api.getConfigManager().getConfig).mockReturnValue(createConfig(config));
return api;
};
// Apply the modifiers from the nth `setViewWithModifiers` call to the given
// view, so that a caller can assert on the resulting view.
export const applySetViewModifiers = (
viewManager: ViewManagerInterface,
view: View,
n = 0,
): View => {
const mock = vi.mocked(viewManager.setViewWithModifiers).mock;
expect(mock.calls.length).greaterThan(n);
return applyViewModifiers(view, mock.calls[n][0]);
};