]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-20042 Removing title when tooltip is present
authorRevanshu Paliwal <revanshu.paliwal@sonarsource.com>
Tue, 15 Aug 2023 08:52:47 +0000 (10:52 +0200)
committersonartech <sonartech@sonarsource.com>
Wed, 16 Aug 2023 20:02:43 +0000 (20:02 +0000)
server/sonar-web/design-system/src/components/Tags.tsx
server/sonar-web/src/main/js/apps/issues/__tests__/IssuesApp-it.tsx
server/sonar-web/src/main/js/apps/projectInformation/about/components/__tests__/MetaTags-test.tsx
server/sonar-web/src/main/js/apps/projects/components/project-card/ProjectCardLanguages.tsx
server/sonar-web/src/main/js/apps/projects/components/project-card/__tests__/ProjectCard-test.tsx
server/sonar-web/src/main/js/components/issue/__tests__/Issue-it.tsx

index fa3dcfc77480e598241ef530fb04f8dc4c42578a..a20757ea8c54df050ba19bd419dd95cacb4992fb 100644 (file)
@@ -62,7 +62,7 @@ export function Tags({
 
   const displayedTagsContent = (open = false) => (
     <Tooltip overlay={open ? undefined : tags.join(', ')}>
-      <span className="sw-inline-flex sw-items-center sw-gap-1" title={tags.join(', ')}>
+      <span className="sw-inline-flex sw-items-center sw-gap-1">
         {/* Display first 3 (tagsToDisplay) tags */}
         {displayedTags.map((tag) => (
           <TagLabel key={tag}>{tag}</TagLabel>
index b9c4fb78f98cb622d1f774272d9840469e025774..51b08bd94b028151f9c4fcdb4a9a4d6a7014a7a3 100644 (file)
@@ -24,6 +24,7 @@ import React from 'react';
 import selectEvent from 'react-select-event';
 import { TabKeys } from '../../../components/rules/RuleTabViewer';
 import { mockLoggedInUser } from '../../../helpers/testMocks';
+import { byRole } from '../../../helpers/testSelector';
 import { ComponentQualifier } from '../../../types/component';
 import { IssueType } from '../../../types/issues';
 import {
@@ -478,13 +479,29 @@ describe('issues item', () => {
       await user.click(listItem.getByText('accessibility'));
       await user.click(listItem.getByText('android'));
     });
-    expect(listItem.getByTitle('accessibility, android')).toBeInTheDocument();
+
+    await user.keyboard('{Escape}');
+    await expect(
+      byRole('button', { name: 'accessibility android +' }).byText('accessibility').get()
+    ).toHaveATooltipWithContent('accessibility, android');
+
+    await act(async () => {
+      await user.click(listItem.getByRole('button', { name: 'accessibility android +' }));
+    });
 
     // Unselect
     await act(async () => {
       await user.click(screen.getByRole('checkbox', { name: 'accessibility' }));
     });
-    expect(listItem.getByTitle('android')).toBeInTheDocument();
+
+    await user.keyboard('{Escape}');
+    await expect(
+      byRole('button', { name: 'android +' }).byText('android').get()
+    ).toHaveATooltipWithContent('android');
+
+    await act(async () => {
+      await user.click(listItem.getByRole('button', { name: 'android +' }));
+    });
 
     await act(async () => {
       await user.click(screen.getByRole('searchbox', { name: 'search.search_for_tags' }));
index 4199cd484e5d91d01ad5d4c33fa341d846b19639..6b445ab9a957050cd7fd7118a379609eb39d0d38 100644 (file)
@@ -61,7 +61,7 @@ it('should allow to edit tags for a project', async () => {
   expect(await screen.findByText('foo, bar')).toBeInTheDocument();
   expect(screen.getByRole('button')).toBeInTheDocument();
 
-  await act(() => user.click(screen.getByRole('button', { name: 'foo, bar +' })));
+  await act(() => user.click(screen.getByRole('button', { name: 'foo bar +' })));
 
   expect(await screen.findByRole('checkbox', { name: 'best' })).toBeInTheDocument();
 
index 116312690bca21cb16cfec19aa8fe60f2720d9d4..69b0e03f3a00df1d74f95a898692a4b40c97790a 100644 (file)
@@ -60,9 +60,7 @@ export function ProjectCardLanguages({ className, distribution, languages }: Pro
 
   return (
     <Tooltip overlay={tooltip}>
-      <span className={className} title={languagesText}>
-        {languagesText}
-      </span>
+      <span className={className}>{languagesText}</span>
     </Tooltip>
   );
 }
index b1da5b7ce96f25b52d23057f6f18910c4e450e28..bff0e35fd2a09df75db3095aaa4b302f36dbc5ae 100644 (file)
@@ -52,10 +52,10 @@ it('should not display the quality gate', () => {
   expect(screen.getByText('projects.not_analyzed.TRK')).toBeInTheDocument();
 });
 
-it('should display tags', () => {
+it('should display tags', async () => {
   const project = { ...PROJECT, tags: ['foo', 'bar'] };
   renderProjectCard(project);
-  expect(screen.getByTitle('foo, bar')).toBeInTheDocument();
+  await expect(screen.getByText('foo')).toHaveATooltipWithContent('foo, bar');
 });
 
 it('should display private badge', () => {
index e7a4e18fff65a2a78ff48cdd0b64b956baae4913..6eb078119d4350650226f0b950df36fcb532fa53 100644 (file)
@@ -300,7 +300,7 @@ function getPageObject() {
     // Tags
     tagsSearchInput: byRole('searchbox'),
     updateTagsBtn: (currentTags?: string[]) =>
-      byRole('button', { name: `${currentTags ? currentTags.join(', ') : 'issue.no_tag'} +` }),
+      byRole('button', { name: `${currentTags ? currentTags.join(' ') : 'issue.no_tag'} +` }),
     toggleTagCheckbox: (name: string) => byRole('checkbox', { name }),
   };