Pressing Esc in left pane composer menu should go back

This commit is contained in:
Evan Hahn 2021-04-02 16:43:39 -05:00 committed by Josh Perez
parent 2d35fa8f57
commit f05d45ac9b
12 changed files with 168 additions and 5 deletions

View file

@ -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(