fix: Ensure a bare ptz_digital action resets the zoom (#2635)
- Closes: #2632
This commit is contained in:
@@ -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]);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user