MM-63411 Don't focus thread textbox automatically when it has a draft (#31250)

* MM-63411 Don't focus thread textbox automatically when it has a draft

* Add E2E test

* Add test files forgotten in previous commit

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
Harrison Healey
2025-06-04 16:08:33 -04:00
коммит произвёл GitHub
родитель a19eb5b9ef
Коммит 6517fa2fd1
7 изменённых файлов: 175 добавлений и 2 удалений

12
e2e-tests/cypress/tests/support/chai.d.ts поставляемый Обычный файл
Просмотреть файл

@@ -0,0 +1,12 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
/// <reference types="cypress" />
declare namespace Cypress {
interface Chainer<Subject> {
(chainer: 'be.focusVisible', {exactStyles}: {exactStyles?: boolean}): Chainable<Subject>;
(chainer: 'not.be.focusVisible', {exactStyles}: {exactStyles?: boolean}): Chainable<Subject>;
}
}

36
e2e-tests/cypress/tests/support/chai.ts Обычный файл
Просмотреть файл

@@ -0,0 +1,36 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
chai.use((chai: Chai.ChaiStatic) => {
function assertIsFoo({exactStyles = true} = {}) {
// eslint-disable-next-line no-underscore-dangle
const obj = this._obj as JQuery<HTMLElement>;
this.assert(
obj.hasClass('a11y--active'),
'expected #{this} to have a11y--active class',
'expected #{this} to not have a11y--active class',
obj,
);
// These should match the styles set on :focus-visible in sass/utils/_modifiers.scss
this.assert(
exactStyles ? obj.css('box-shadow').includes('0px 0px 1px 3px') : Boolean(obj.css('box-shadow')),
'expected #{this} to have focused element style (box-shadow)',
'expected #{this} to not have focused element style (box-shadow)',
obj.css('box-shadow'),
);
this.assert(
exactStyles ? obj.css('border-radius') === '4px' : Boolean(obj.css('border-radius')),
'expected #{this} to have focused element style (border-radius)',
'expected #{this} to not have focused element style (border-radius)',
obj.css('border-radius'),
);
return this;
}
/* eslint-enable no-underscore-dangle */
chai.Assertion.addMethod('a11yVisible', assertIsFoo);
});