Draws significant inspiration (and direct styling) from https://github.com/dermotduffy/advanced-camera-card/pull/2447 . Thank you @Maudfer ! BREAKING CHANGE: The microphone condition previously bundled two unrelated signals — whether a two-way-audio session was connected and whether the microphone was muted. Connection state is now its own dedicated call condition, and microphone is reserved purely for mute state. Configs are upgraded automatically (the card rewrites affected conditions under overrides, elements, and automations). If you maintain config by hand, convert as follows: If you only used connected: # Before ```yaml condition: microphone connected: true ``` # After ```yaml condition: call call: true ``` If you used both connected and muted — they must be split into two conditions, since they no longer live together: # Before ```yaml condition: microphone connected: true muted: false ``` # After ```yaml condition: and conditions: - condition: call call: true - condition: microphone muted: false ```
31 lines
1.1 KiB
TypeScript
31 lines
1.1 KiB
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import { isAutoHidden, resolveAutoHideState } from '../../src/components-lib/auto-hide';
|
|
|
|
describe('isAutoHidden', () => {
|
|
it('should not hide with an empty condition list', () => {
|
|
expect(isAutoHidden([], { call: true, casting: true })).toBe(false);
|
|
});
|
|
|
|
it('should hide when a configured condition is active', () => {
|
|
expect(isAutoHidden(['call'], { call: true, casting: false })).toBe(true);
|
|
});
|
|
|
|
it('should not hide when no configured condition is active', () => {
|
|
expect(isAutoHidden(['call'], { call: false, casting: true })).toBe(false);
|
|
});
|
|
|
|
it('should hide when any of multiple configured conditions is active', () => {
|
|
expect(isAutoHidden(['call', 'casting'], { call: false, casting: true })).toBe(true);
|
|
});
|
|
});
|
|
|
|
describe('resolveAutoHideState', () => {
|
|
it('should resolve with the supplied call state', () => {
|
|
expect(resolveAutoHideState(true)).toEqual({ call: true, casting: false });
|
|
});
|
|
|
|
it('should default the call state to false', () => {
|
|
expect(resolveAutoHideState()).toEqual({ call: false, casting: false });
|
|
});
|
|
});
|