* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-import { screen, within } from '@testing-library/react';
+import { act, screen, within } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import React from 'react';
import { Route } from 'react-router-dom';
handler.reset();
});
+describe('rendering', () => {
+ it('should render code variants correctly', async () => {
+ renderSecurityHotspotsApp(
+ 'security_hotspots?id=guillaume-peoch-sonarsource_benflix_AYGpXq2bd8qy4i0eO9ed&hotspots=test-2'
+ );
+ expect(await screen.findAllByText('variant 1, variant 2')).toHaveLength(2);
+ });
+});
+
it('should navigate when comming from SonarLint', async () => {
// On main branch
const rtl = renderSecurityHotspotsApp(
await user.click(screen.getByRole('textbox', { name: 'hotspots.status.add_comment' }));
await user.keyboard(comment);
- await user.click(ui.changeStatus.get());
+ await act(async () => {
+ await user.click(ui.changeStatus.get());
+ });
expect(setSecurityHotspotStatus).toHaveBeenLastCalledWith('test-1', {
comment: 'COMMENT-TEXT',
await user.keyboard(comment);
// Close the panel
- await user.keyboard('{Escape}');
+ await act(async () => {
+ await user.keyboard('{Escape}');
+ });
+
// Check panel is closed
expect(ui.panel.query()).not.toBeInTheDocument();
*/
import React from 'react';
import Link from '../../../components/common/Link';
+import Tooltip from '../../../components/controls/Tooltip';
import { IssueMessageHighlighting } from '../../../components/issue/IssueMessageHighlighting';
import { translate } from '../../../helpers/l10n';
import { getRuleUrl } from '../../../helpers/urls';
hotspot={hotspot}
onStatusChange={(statusOption) => props.onUpdateHotspot(true, statusOption)}
/>
- <div className="display-flex-end">
- <div className="display-inline-flex-center it__hs-assignee">
- <div className="big-spacer-right">{`${translate('assignee')}: `}</div>
+ <div className="display-flex-end display-flex-column abs-width-240">
+ {hotspot.codeVariants && hotspot.codeVariants.length > 0 && (
+ <Tooltip overlay={hotspot.codeVariants.join(', ')}>
+ <div className="spacer-bottom display-flex-center">
+ <div>{translate('issues.facet.codeVariants')}:</div>
+ <div className="text-bold spacer-left spacer-right text-ellipsis">
+ {hotspot.codeVariants.join(', ')}
+ </div>
+ </div>
+ </Tooltip>
+ )}
+ <div className="display-flex-center it__hs-assignee">
+ <div className="big-spacer-right">{translate('assignee')}:</div>
<Assignee hotspot={hotspot} onAssigneeChange={props.onUpdateHotspot} />
</div>
</div>