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>
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 {
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' }));
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();
return (
<Tooltip overlay={tooltip}>
- <span className={className} title={languagesText}>
- {languagesText}
- </span>
+ <span className={className}>{languagesText}</span>
</Tooltip>
);
}
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', () => {
// 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 }),
};