MM-62045 Enable eslint-plugin-jsx-a11y and fix occurrences of jsx-a11y/anchor-has-content (#29453)
* Enable eslint-plugin-jsx-a11y and add standard rules as warnings or errors * Fix jsx-a11y/anchor-has-content in BooleanSetting and add SettingSet The invisible anchor was presumably supposed to let people jump from one setting's help text to another setting. That didn't work for boolean settings because there's no element with the ID of the setting. Instead of an empty anchor, we needed to give something else that ID. To improve the semantics of those settings, I also put those settings into a fieldset with a legend containing the setting's label text instead of using an actual label element as per how it's done on the MDN. We'll probably end up using the SettingSet for other settings as well. Finally, I also fixed the link used by admin.service.useLetsEncryptDescription.disabled to point to the right place and made it so that the link would open in the current tab. Ideally, I'd also remove the Markdown from that help text, but there's a lot here already. * Fix jsx-a11y/anchor-has-content in CheckboxSetting * Use SettingSet in PasswordSettings to improve semantics and layout The main reason for doing this is to use a proper legend and fieldset for these settings, but it also has the benefit of removing the extra spacing from in between these settings. * Change CopyText to use a button and require an aria-label for it This fixes two ESLint warnings: - This was failing jsx-a11y/anchor-has-content because it was an empty anchor element. I fixed that by giving it an aria-label matching the tooltip of the CopyText, but that required that the label was a string, so I had to change how CopyText is used. I also made the label required so that people give an accessible explanation of what is being copied. - This was also failing jsx-a11y/anchor-is-valid because it should be a button instead of a link. I applied the btn-link class and made it so that that doesn't override the link's height which hopefully doesn't cause problems anywhere else. This is to fix jsx-a11y/anchor-has-content and jsx-a11y/anchor-is-valid in the component. The ESLint plugin is complaining that this component is using an anchor instead of a button element, so I changed that * Turn jsx-a11y/anchor-has-content to be an error * Update snapshots * Remove lingering reference to nested prop which has been removed * Changing system console password settings to a list and update padding for alerts in it * Fix typo in SettingSet * Update E2E tests to enable Elasticsearch by ID and remove duplicate enableElasticSearch helper * Update E2E test to look for a legend instead of a label * Fix typo in snapshot
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
521abfb2e8
Коммит
a21d470bee
@@ -36,43 +36,6 @@ function createSearchData(prefix: string) {
|
||||
});
|
||||
}
|
||||
|
||||
function enableElasticSearch() {
|
||||
// # Enable elastic search via the API
|
||||
cy.apiUpdateConfig({
|
||||
ElasticsearchSettings: {
|
||||
EnableIndexing: true,
|
||||
EnableSearching: true,
|
||||
},
|
||||
} as Cypress.AdminConfig);
|
||||
|
||||
// # Navigate to the elastic search setting page
|
||||
cy.visit('/admin_console/environment/elasticsearch');
|
||||
cy.get('[data-testid="enableIndexing"] > .col-sm-8 > :nth-child(2)').click();
|
||||
|
||||
// * Test the connection and verify that we are successful
|
||||
cy.contains('button', 'Test Connection').click();
|
||||
cy.get('.alert-success').should('have.text', 'Test successful. Configuration saved.');
|
||||
|
||||
// # Index so we are up to date
|
||||
cy.contains('button', 'Index Now').click();
|
||||
|
||||
// # Small wait to ensure new row is added
|
||||
cy.wait(TIMEOUTS.ONE_SEC).get('.job-table__table').find('tbody > tr').eq(0).as('firstRow');
|
||||
|
||||
// * Newest row should eventually result in Success
|
||||
const checkFirstRow = () => {
|
||||
return cy.get('@firstRow').then((el) => {
|
||||
return el.find('.status-icon-success').length > 0;
|
||||
});
|
||||
};
|
||||
const options = {
|
||||
timeout: TIMEOUTS.TWO_MIN,
|
||||
interval: TIMEOUTS.TWO_SEC,
|
||||
errorMsg: 'Reindex did not succeed in time',
|
||||
};
|
||||
cy.waitUntil(checkFirstRow, options);
|
||||
}
|
||||
|
||||
function getTestUsers(prefix = ''): Record<string, SimpleUser> {
|
||||
if (Cypress.env('searchTestUsers')) {
|
||||
return JSON.parse(Cypress.env('searchTestUsers'));
|
||||
@@ -281,7 +244,6 @@ export {
|
||||
createPrivateChannel,
|
||||
createPublicChannel,
|
||||
createSearchData,
|
||||
enableElasticSearch,
|
||||
getTestUsers,
|
||||
getPostTextboxInput,
|
||||
getQuickChannelSwitcherInput,
|
||||
|
||||
@@ -82,7 +82,7 @@ export function enableElasticSearch() {
|
||||
|
||||
// # Navigate to the elastic search setting page
|
||||
cy.visit('/admin_console/environment/elasticsearch');
|
||||
cy.get('[data-testid="enableIndexing"] > .col-sm-8 > :nth-child(2)').click();
|
||||
cy.get('#enableIndexingtrue').click();
|
||||
|
||||
// * Test the connection and verify that we are successful
|
||||
cy.contains('button', 'Test Connection').click();
|
||||
|
||||
@@ -29,7 +29,7 @@ describe('Elasticsearch system console', () => {
|
||||
|
||||
// # Visit the Elasticsearch settings page
|
||||
cy.visit('/admin_console/environment/elasticsearch');
|
||||
cy.get('[data-testid="enableIndexing"] > .col-sm-8 > :nth-child(2)').click();
|
||||
cy.get('#enableIndexingtrue').click();
|
||||
|
||||
// # Enable Auto complete
|
||||
cy.get('#enableAutocompletetrue').check().should('be.checked');
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
|
||||
import {getRandomLetter} from '../../../../utils';
|
||||
import {doTestQuickChannelSwitcher} from '../../autocomplete/common_test';
|
||||
import {createSearchData, enableElasticSearch, SimpleUser} from '../../autocomplete/helpers';
|
||||
import {createSearchData, SimpleUser} from '../../autocomplete/helpers';
|
||||
import {enableElasticSearch} from './helpers';
|
||||
|
||||
describe('Autocomplete with Elasticsearch - Users', () => {
|
||||
const prefix = getRandomLetter(3);
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
|
||||
import {getRandomLetter} from '../../../../utils';
|
||||
import {doTestPostextbox} from '../../autocomplete/common_test';
|
||||
import {createSearchData, enableElasticSearch, SimpleUser} from '../../autocomplete/helpers';
|
||||
import {createSearchData, SimpleUser} from '../../autocomplete/helpers';
|
||||
import {enableElasticSearch} from './helpers';
|
||||
|
||||
describe('Autocomplete with Elasticsearch - Users', () => {
|
||||
const prefix = getRandomLetter(3);
|
||||
|
||||
@@ -13,7 +13,8 @@
|
||||
import {Team} from '@mattermost/types/teams';
|
||||
import {getRandomLetter} from '../../../../utils';
|
||||
import {doTestDMChannelSidebar, doTestUserChannelSection} from '../../autocomplete/common_test';
|
||||
import {createSearchData, enableElasticSearch, SimpleUser} from '../../autocomplete/helpers';
|
||||
import {createSearchData, SimpleUser} from '../../autocomplete/helpers';
|
||||
import {enableElasticSearch} from './helpers';
|
||||
|
||||
describe('Autocomplete with Elasticsearch - Users', () => {
|
||||
const prefix = getRandomLetter(3);
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
// Group: @channels @enterprise @elasticsearch @incoming_webhook @not_cloud
|
||||
|
||||
import * as TIMEOUTS from '../../../../fixtures/timeouts';
|
||||
import {enableElasticSearch} from '../../autocomplete/helpers';
|
||||
import {enableElasticSearch} from '../elasticsearch_autocomplete/helpers';
|
||||
|
||||
describe('Incoming webhook', () => {
|
||||
let testTeam;
|
||||
|
||||
@@ -138,7 +138,7 @@ describe('Customization', () => {
|
||||
|
||||
cy.findByTestId('TeamSettings.EnableCustomBrand').should('be.visible').within(() => {
|
||||
// * Verify that setting is visible and matches text content
|
||||
cy.get('label:first').should('be.visible').and('have.text', 'Enable Custom Branding: ');
|
||||
cy.get('legend:contains("Enable Custom Branding: ")').should('be.visible');
|
||||
|
||||
// * Verify that help setting is visible and matches text content
|
||||
const content = 'Enable custom branding to show an image of your choice, uploaded below, and some help text, written below, on the login page.';
|
||||
|
||||
Ссылка в новой задаче
Block a user