]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-17845 [1109939] Programmatic label does not convey purpose of control
authorKevin Silva <kevin.silva@sonarsource.com>
Thu, 12 Jan 2023 10:45:25 +0000 (11:45 +0100)
committersonartech <sonartech@sonarsource.com>
Mon, 16 Jan 2023 20:03:42 +0000 (20:03 +0000)
server/sonar-web/src/main/js/apps/account/__tests__/Account-it.tsx
server/sonar-web/src/main/js/apps/create/project/__tests__/Bitbucket-it.tsx
server/sonar-web/src/main/js/apps/create/project/__tests__/BitbucketCloud-it.tsx
server/sonar-web/src/main/js/apps/create/project/__tests__/GitHub-it.tsx
server/sonar-web/src/main/js/apps/create/project/__tests__/GitLab-it.tsx
server/sonar-web/src/main/js/apps/issues/__tests__/IssuesApp-it.tsx
server/sonar-web/src/main/js/components/common/__tests__/MultiSelect-test.tsx
server/sonar-web/src/main/js/components/controls/SearchBox.tsx
server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/SearchBox-test.tsx.snap

index 7d5518dc48054693d2a925acaaef31306fdbef36..e3bcc746f788b74a6b865e4c7f7c99643fc795dc 100644 (file)
@@ -21,7 +21,7 @@ import { screen, within } from '@testing-library/react';
 import userEvent from '@testing-library/user-event';
 import { UserEvent } from '@testing-library/user-event/dist/types/setup/setup';
 import selectEvent from 'react-select-event';
-import { byLabelText, byRole, byText } from 'testing-library-selector';
+import { byRole, byText } from 'testing-library-selector';
 import { getMyProjects, getScannableProjects } from '../../../api/components';
 import NotificationsMock from '../../../api/mocks/NotificationsMock';
 import UserTokensMock from '../../../api/mocks/UserTokensMock';
@@ -469,7 +469,7 @@ describe('notifications page', () => {
     title: byRole('button', { name: 'my_profile.per_project_notifications.add' }),
     addButton: byRole('button', { name: 'my_profile.per_project_notifications.add' }),
     addModalButton: byRole('button', { name: 'add_verb' }),
-    searchInput: byLabelText('search_verb', { selector: 'input' }),
+    searchInput: byRole('searchbox', { name: 'search.placeholder' }),
     sonarQubeProject: byRole('heading', { name: 'SonarQube' }),
     checkbox: (type: NotificationProjectType) =>
       byRole('checkbox', {
@@ -554,7 +554,7 @@ describe('notifications page', () => {
     await user.click(
       screen.getByRole('button', { name: 'my_profile.per_project_notifications.add' })
     );
-    expect(await screen.findByLabelText('search_verb', { selector: 'input' })).toBeInTheDocument();
+    expect(screen.getByLabelText('search.placeholder', { selector: 'input' })).toBeInTheDocument();
     await user.keyboard('sonarqube');
 
     await user.click(screen.getByText('SonarQube'));
index 5ee094b2445bf466d4737757aca3328ff436d0ae..e8d1fd22e8147aadcc01dceb05cdb38bdb5561f8 100644 (file)
@@ -134,7 +134,7 @@ it('should show search filter when PAT is already set', async () => {
   });
 
   const inputSearch = screen.getByRole('searchbox', {
-    name: 'search_verb',
+    name: 'onboarding.create_project.search_repositories_by_name',
   });
   await user.click(inputSearch);
   await user.keyboard('search');
index 35ea5813023ffe99e6fc6b1dc6ed7816e54d4d6e..7778955775c63e8fd24dd5516e7490f61c56c936 100644 (file)
@@ -163,7 +163,7 @@ it('should show search filter when PAT is already set', async () => {
   );
 
   const inputSearch = screen.getByRole('searchbox', {
-    name: 'search_verb',
+    name: 'onboarding.create_project.search_prompt',
   });
   await user.click(inputSearch);
   await user.keyboard('search');
index 5f123b4f7709d7a9df7fe4fec9adc5f26fef5391..9685d20f82262c40963a0249c9d532910067be5b 100644 (file)
@@ -148,7 +148,7 @@ it('should show search filter when the authentication is successful', async () =
   await selectEvent.select(ui.organizationSelector.get(), [/org-1/]);
 
   const inputSearch = screen.getByRole('searchbox', {
-    name: 'search_verb',
+    name: 'onboarding.create_project.search_repositories',
   });
   await user.click(inputSearch);
   await user.keyboard('search');
index d650df1467a5dd9e4820dd4936bf77db77456eb9..f2a3a26fcdf3e97d389f8da7fe9e7dd5e2c11f2d 100644 (file)
@@ -122,7 +122,7 @@ it('should show search filter when PAT is already set', async () => {
   });
 
   const inputSearch = screen.getByRole('searchbox', {
-    name: 'search_verb',
+    name: 'onboarding.create_project.search_prompt',
   });
   await user.click(inputSearch);
   await user.keyboard('sea');
index c0488f8280673addfcbcaae49593eaf539009c12..8a5f32ce976e461cc00c9340cc64fd0d69356fc5 100644 (file)
@@ -390,9 +390,9 @@ it('should be able to perform action on issues', async () => {
       name: `issue.assign.unassigned_click_to_assign`,
     })
   );
-  expect(screen.getByRole('searchbox', { name: 'search_verb' })).toBeInTheDocument();
+  expect(screen.getByRole('searchbox', { name: 'search.search_for_users' })).toBeInTheDocument();
 
-  await user.click(screen.getByRole('searchbox', { name: 'search_verb' }));
+  await user.click(screen.getByRole('searchbox', { name: 'search.search_for_users' }));
   await user.keyboard('luke');
   expect(screen.getByText('Skywalker')).toBeInTheDocument();
   await user.keyboard('{ArrowUp}{enter}');
@@ -452,7 +452,7 @@ it('should be able to perform action on issues', async () => {
   // changing tags
   expect(screen.getByText('issue.no_tag')).toBeInTheDocument();
   await user.click(screen.getByText('issue.no_tag'));
-  expect(screen.getByRole('searchbox', { name: 'search_verb' })).toBeInTheDocument();
+  expect(screen.getByRole('searchbox', { name: 'search.search_for_tags' })).toBeInTheDocument();
   expect(screen.getByText('android')).toBeInTheDocument();
   expect(screen.getByText('accessibility')).toBeInTheDocument();
 
@@ -464,7 +464,7 @@ it('should be able to perform action on issues', async () => {
   await user.click(screen.getByText('accessibility'));
   expect(screen.getByTitle('android')).toBeInTheDocument();
 
-  await user.click(screen.getByRole('searchbox', { name: 'search_verb' }));
+  await user.click(screen.getByRole('searchbox', { name: 'search.search_for_tags' }));
   await user.keyboard('addNewTag');
   expect(
     screen.getByRole('checkbox', { name: 'create_new_element: addnewtag' })
@@ -531,7 +531,7 @@ it('should open the actions popup using keyboard shortcut', async () => {
 
   // open tags popup on key press 't'
   await user.keyboard('t');
-  expect(screen.getByRole('searchbox', { name: 'search_verb' })).toBeInTheDocument();
+  expect(screen.getByRole('searchbox', { name: 'search.search_for_tags' })).toBeInTheDocument();
   expect(screen.getByText('android')).toBeInTheDocument();
   expect(screen.getByText('accessibility')).toBeInTheDocument();
   // closing tags popup
@@ -539,7 +539,7 @@ it('should open the actions popup using keyboard shortcut', async () => {
 
   // open assign popup on key press 'a'
   await user.keyboard('a');
-  expect(screen.getByRole('searchbox', { name: 'search_verb' })).toBeInTheDocument();
+  expect(screen.getByRole('searchbox', { name: 'search.search_for_tags' })).toBeInTheDocument();
 });
 
 it('should not open the actions popup using keyboard shortcut when keyboard shortcut flag is disabled', async () => {
index d56deb4acfd2ca7f34c7dc5c45aff97ef71a81dc..2c9db394bbd31fbabed8e1b32cf6092cdf3b205f 100644 (file)
@@ -25,7 +25,7 @@ import MultiSelect from '../MultiSelect';
 
 const ui = {
   checkbox: (name: string) => byRole('checkbox', { name }),
-  search: byRole('searchbox', { name: 'search_verb' }),
+  search: byRole('searchbox', { name: 'search' }),
   noResult: byText('no_results_for_x.notfound'),
 };
 
@@ -108,7 +108,7 @@ function renderMultiSelect(override?: Partial<MultiSelect['props']>) {
         onSearch={onSearch}
         onSelect={onSelect}
         onUnselect={onUnselect}
-        placeholder=""
+        placeholder="search"
         {...props}
       />
     );
index e30a6fda4471a51fd740f957fd7207a51b3803d2..0de8c213ba18c22da149f8f24dc18301d5deb5f4 100644 (file)
@@ -143,7 +143,7 @@ export default class SearchBox extends React.PureComponent<Props, State> {
         }
       >
         <input
-          aria-label={translate('search_verb')}
+          aria-label={this.props.placeholder}
           autoComplete="off"
           autoFocus={this.props.autoFocus}
           className={inputClassName}
index c600dd5b2c4059874d3f56644028ecfcc282ae9a..caaaf8bce8940442871b303e456d77eef19dead7 100644 (file)
@@ -6,7 +6,7 @@ exports[`renders 1`] = `
   title=""
 >
   <input
-    aria-label="search_verb"
+    aria-label="placeholder"
     autoComplete="off"
     className="search-box-input"
     maxLength={150}