* MM-62312 - modal focus management; revamp quick switch channel modal! * get quick switch test working * configure the generic modal to accept refs to focus within and onhide to the origin element * apply pr feedback, get modal element get autofocus, use id instead of ref * update more direct channels modal to use generic modal * fix unit tests and snapshots * fix unit tests * fix modal margin top to fit in smaller screens * fix e2e test * remove unnecesary onexited extra call * fix e2e tests * set correct label * fix snapshots * create helper function for sending custom focus event * migrate quick switch modal to use new approach to focus * migrate more direct channels modal to new approach * fix snapshots * fix types * fix modal closing behavior * fix snapshots * fix cypress tests * remove only --------- Co-authored-by: Mattermost Build <build@mattermost.com>
78 строки
2.8 KiB
TypeScript
78 строки
2.8 KiB
TypeScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
/// <reference types="cypress" />
|
|
|
|
// ***************************************************************
|
|
// Each command should be properly documented using JSDoc.
|
|
// See https://jsdoc.app/index.html for reference.
|
|
// Basic requirements for documentation are the following:
|
|
// - Meaningful description
|
|
// - Each parameter with `@params`
|
|
// - Return value with `@returns`
|
|
// - Example usage with `@example`
|
|
// Custom command should follow naming convention of having `ui` prefix, e.g. `uiCreateChannel`.
|
|
// ***************************************************************
|
|
|
|
declare namespace Cypress {
|
|
interface Chainable {
|
|
|
|
/**
|
|
* Create a new channel in the current team.
|
|
* @param {string} options.prefix - Prefix for the name of the channel, it will be added a random string ot it.
|
|
* @param {boolean} options.isPrivate - is the channel private or public (default)?
|
|
* @param {string} options.purpose - Channel's purpose
|
|
* @param {string} options.header - Channel's header
|
|
* @param {boolean} options.isNewSidebar) - the new sidebar has a different ui flow, set this setting to true to use that. Defaults to false.
|
|
* @param {string} options.createBoard) - Board template to create
|
|
*
|
|
* @example
|
|
* cy.uiCreateChannel({prefix: 'private-channel-', isPrivate: true, purpose: 'my private channel', header: 'my private header', isNewSidebar: false});
|
|
*/
|
|
uiCreateChannel(options: Record<string, unknown>): Chainable;
|
|
|
|
/**
|
|
* Add users to the current channel.
|
|
* @param {string[]} usernameList - list of userids to add to the channel
|
|
*
|
|
* @example
|
|
* cy.uiAddUsersToCurrentChannel(['user1', 'user2']);
|
|
*/
|
|
uiAddUsersToCurrentChannel(usernameList: string[]);
|
|
|
|
/**
|
|
* Invite users to the current channel.
|
|
* @param {string[]} usernameList - list of userids to be invited to the channel
|
|
*
|
|
* @example
|
|
* cy.uiInviteUsersToCurrentChannel(['user1', 'user2']);
|
|
*/
|
|
uiInviteUsersToCurrentChannel(usernameList: string[]);
|
|
|
|
/**
|
|
* Archive the current channel.
|
|
*
|
|
* @example
|
|
* cy.uiArchiveChannel();
|
|
*/
|
|
uiArchiveChannel();
|
|
|
|
/**
|
|
* Unarchive the current channel.
|
|
*
|
|
* @example
|
|
* cy.uiUnarchiveChannel();
|
|
*/
|
|
uiUnarchiveChannel();
|
|
|
|
/**
|
|
* Leave the current channel.
|
|
* @param {boolean} isPrivate - is the channel private or public (default)?
|
|
*
|
|
* @example
|
|
* cy.uiLeaveChannel(true);
|
|
*/
|
|
uiLeaveChannel(isPrivate?: boolean);
|
|
}
|
|
}
|