mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-09-02 19:31:41 +01:00
Fix composer keyboard shortcuts in default no modal state
Co-authored-by: ayumi-signal <143036029+ayumi-signal@users.noreply.github.com>
This commit is contained in:
co-authored by
ayumi-signal
parent
6a9d2968ad
commit
4bdc01e84b
@@ -5,7 +5,10 @@ import { createSelector } from 'reselect';
|
||||
|
||||
import type { StateType } from '../reducer.preload.ts';
|
||||
import type { GlobalModalsStateType } from '../ducks/globalModals.preload.ts';
|
||||
import { UsernameOnboardingState } from '../../types/globalModals.std.ts';
|
||||
import {
|
||||
PinReminderState,
|
||||
UsernameOnboardingState,
|
||||
} from '../../types/globalModals.std.ts';
|
||||
import type { StateSelector } from '../types.std.ts';
|
||||
import type { PinMessageDialogData } from '../smart/PinMessageDialog.preload.tsx';
|
||||
|
||||
@@ -20,6 +23,10 @@ export const isShowingAnyModal = createSelector(
|
||||
return value === UsernameOnboardingState.Open;
|
||||
}
|
||||
|
||||
if (key === 'pinReminderState') {
|
||||
return value === PinReminderState.Modal;
|
||||
}
|
||||
|
||||
return Boolean(value);
|
||||
})
|
||||
);
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
// Copyright 2026 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import { assert } from 'chai';
|
||||
|
||||
import type { StateType } from '../../../state/reducer.preload.ts';
|
||||
import type { GlobalModalsStateType } from '../../../state/ducks/globalModals.preload.ts';
|
||||
import { getEmptyState } from '../../../state/ducks/globalModals.preload.ts';
|
||||
|
||||
import { isShowingAnyModal } from '../../../state/selectors/globalModals.std.ts';
|
||||
import { UsernameOnboardingState } from '../../../types/globalModals.std.ts';
|
||||
|
||||
describe('both/state/selectors/globalModals', () => {
|
||||
function getRootState(
|
||||
overrides: Readonly<Partial<GlobalModalsStateType>>
|
||||
): StateType {
|
||||
return {
|
||||
globalModals: {
|
||||
...getEmptyState(),
|
||||
...overrides,
|
||||
},
|
||||
} as StateType;
|
||||
}
|
||||
|
||||
describe('#isShowingAnyModal', () => {
|
||||
it('returns false in default state', () => {
|
||||
const state = getRootState({});
|
||||
assert.isFalse(isShowingAnyModal(state));
|
||||
});
|
||||
|
||||
it('returns true when showing a modal', () => {
|
||||
const state = getRootState({
|
||||
errorModalProps: { title: 'hi', description: 'im a cat' },
|
||||
});
|
||||
assert.isTrue(isShowingAnyModal(state));
|
||||
});
|
||||
|
||||
it('returns true when showing username megaphone', () => {
|
||||
const state = getRootState({
|
||||
usernameOnboardingState: UsernameOnboardingState.Open,
|
||||
});
|
||||
assert.isTrue(isShowingAnyModal(state));
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user