mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-04-24 18:38:15 +01:00
Pressing Esc in left pane composer menu should go back
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import { assert } from 'chai';
|
||||
import * as sinon from 'sinon';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
import { RowType } from '../../../components/ConversationList';
|
||||
import { FindDirection } from '../../../components/leftPane/LeftPaneHelper';
|
||||
@@ -15,6 +16,15 @@ describe('LeftPaneArchiveHelper', () => {
|
||||
type: 'direct' as const,
|
||||
});
|
||||
|
||||
describe('getBackAction', () => {
|
||||
it('returns the "show inbox" action', () => {
|
||||
const showInbox = sinon.fake();
|
||||
const helper = new LeftPaneArchiveHelper({ archivedConversations: [] });
|
||||
|
||||
assert.strictEqual(helper.getBackAction({ showInbox }), showInbox);
|
||||
});
|
||||
});
|
||||
|
||||
describe('getRowCount', () => {
|
||||
it('returns the number of archived conversations', () => {
|
||||
assert.strictEqual(
|
||||
|
||||
@@ -45,6 +45,18 @@ describe('LeftPaneChooseGroupMembersHelper', () => {
|
||||
sinonSandbox.restore();
|
||||
});
|
||||
|
||||
describe('getBackAction', () => {
|
||||
it('returns the "show composer" action', () => {
|
||||
const startComposing = sinon.fake();
|
||||
const helper = new LeftPaneChooseGroupMembersHelper(defaults);
|
||||
|
||||
assert.strictEqual(
|
||||
helper.getBackAction({ startComposing }),
|
||||
startComposing
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('getRowCount', () => {
|
||||
it('returns 0 if there are no contacts', () => {
|
||||
assert.strictEqual(
|
||||
|
||||
@@ -35,6 +35,19 @@ describe('LeftPaneComposeHelper', () => {
|
||||
sinonSandbox.restore();
|
||||
});
|
||||
|
||||
describe('getBackAction', () => {
|
||||
it('returns the "show inbox" action', () => {
|
||||
const showInbox = sinon.fake();
|
||||
const helper = new LeftPaneComposeHelper({
|
||||
composeContacts: [],
|
||||
regionCode: 'US',
|
||||
searchTerm: '',
|
||||
});
|
||||
|
||||
assert.strictEqual(helper.getBackAction({ showInbox }), showInbox);
|
||||
});
|
||||
});
|
||||
|
||||
describe('getRowCount', () => {
|
||||
it('returns 1 (for the "new group" button) if not searching and there are no contacts', () => {
|
||||
assert.strictEqual(
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import { assert } from 'chai';
|
||||
import * as sinon from 'sinon';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
import { RowType } from '../../../components/ConversationList';
|
||||
import { FindDirection } from '../../../components/leftPane/LeftPaneHelper';
|
||||
@@ -15,6 +16,24 @@ describe('LeftPaneInboxHelper', () => {
|
||||
type: 'direct' as const,
|
||||
});
|
||||
|
||||
describe('getBackAction', () => {
|
||||
it("returns undefined; you can't go back from the main inbox", () => {
|
||||
const helper = new LeftPaneInboxHelper({
|
||||
conversations: [],
|
||||
pinnedConversations: [],
|
||||
archivedConversations: [],
|
||||
});
|
||||
|
||||
assert.isUndefined(
|
||||
helper.getBackAction({
|
||||
showChooseGroupMembers: sinon.fake(),
|
||||
showInbox: sinon.fake(),
|
||||
startComposing: sinon.fake(),
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('getRowCount', () => {
|
||||
it('returns 0 if there are no conversations', () => {
|
||||
const helper = new LeftPaneInboxHelper({
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import { assert } from 'chai';
|
||||
import * as sinon from 'sinon';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
import { RowType } from '../../../components/ConversationList';
|
||||
|
||||
@@ -19,6 +20,25 @@ describe('LeftPaneSearchHelper', () => {
|
||||
conversationId: uuid(),
|
||||
});
|
||||
|
||||
describe('getBackAction', () => {
|
||||
it('returns undefined; going back is handled elsewhere in the app', () => {
|
||||
const helper = new LeftPaneSearchHelper({
|
||||
conversationResults: { isLoading: false, results: [] },
|
||||
contactResults: { isLoading: false, results: [] },
|
||||
messageResults: { isLoading: false, results: [] },
|
||||
searchTerm: 'foo',
|
||||
});
|
||||
|
||||
assert.isUndefined(
|
||||
helper.getBackAction({
|
||||
showChooseGroupMembers: sinon.fake(),
|
||||
showInbox: sinon.fake(),
|
||||
startComposing: sinon.fake(),
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('getRowCount', () => {
|
||||
it('returns 0 when there are no search results', () => {
|
||||
const helper = new LeftPaneSearchHelper({
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import { assert } from 'chai';
|
||||
import * as sinon from 'sinon';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
import { RowType } from '../../../components/ConversationList';
|
||||
|
||||
@@ -14,6 +15,38 @@ describe('LeftPaneSetGroupMetadataHelper', () => {
|
||||
type: 'direct' as const,
|
||||
});
|
||||
|
||||
describe('getBackAction', () => {
|
||||
it('returns the "show composer" action if a request is not active', () => {
|
||||
const showChooseGroupMembers = sinon.fake();
|
||||
const helper = new LeftPaneSetGroupMetadataHelper({
|
||||
groupAvatar: undefined,
|
||||
groupName: '',
|
||||
hasError: false,
|
||||
isCreating: false,
|
||||
selectedContacts: [],
|
||||
});
|
||||
|
||||
assert.strictEqual(
|
||||
helper.getBackAction({ showChooseGroupMembers }),
|
||||
showChooseGroupMembers
|
||||
);
|
||||
});
|
||||
|
||||
it("returns undefined (i.e., you can't go back) if a request is active", () => {
|
||||
const helper = new LeftPaneSetGroupMetadataHelper({
|
||||
groupAvatar: undefined,
|
||||
groupName: 'Foo Bar',
|
||||
hasError: false,
|
||||
isCreating: true,
|
||||
selectedContacts: [],
|
||||
});
|
||||
|
||||
assert.isUndefined(
|
||||
helper.getBackAction({ showChooseGroupMembers: sinon.fake() })
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('getRowCount', () => {
|
||||
it('returns 0 if there are no contacts', () => {
|
||||
assert.strictEqual(
|
||||
|
||||
Reference in New Issue
Block a user