From 92b539baecf11d5f743b66d5281d740dea893f02 Mon Sep 17 00:00:00 2001 From: Jeremy Davis Date: Thu, 24 Nov 2022 17:06:36 +0800 Subject: SONAR-17623 Preserve code tab scrolling and state --- .../main/js/apps/issues/__tests__/IssueApp-it.tsx | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'server/sonar-web/src/main/js/apps/issues') diff --git a/server/sonar-web/src/main/js/apps/issues/__tests__/IssueApp-it.tsx b/server/sonar-web/src/main/js/apps/issues/__tests__/IssueApp-it.tsx index e53b3ce3f0f..5b718e55290 100644 --- a/server/sonar-web/src/main/js/apps/issues/__tests__/IssueApp-it.tsx +++ b/server/sonar-web/src/main/js/apps/issues/__tests__/IssueApp-it.tsx @@ -22,6 +22,7 @@ import userEvent from '@testing-library/user-event'; import React from 'react'; import selectEvent from 'react-select-event'; import IssuesServiceMock from '../../../api/mocks/IssuesServiceMock'; +import { TabKeys } from '../../../components/rules/RuleTabViewer'; import { renderOwaspTop102021Category } from '../../../helpers/security-standard'; import { mockCurrentUser } from '../../../helpers/testMocks'; import { renderApp, renderAppRoutes } from '../../../helpers/testReactTestingUtils'; @@ -534,15 +535,17 @@ it('should show code tabs when any secondary location is selected', async () => screen.getByRole('tab', { name: 'coding_rules.description_section.title.root_cause' }) ); expect( - screen.queryByRole('row', { - name: '2 source_viewer.tooltip.covered import java.util. ArrayList ;', + screen.queryByRole('tab', { + name: `issue.tabs.${TabKeys.Code}`, + selected: true, }) ).not.toBeInTheDocument(); await user.click(screen.getByRole('button', { name: '1 location 1' })); expect( - screen.getByRole('row', { - name: '2 source_viewer.tooltip.covered import java.util. ArrayList ;', + screen.getByRole('tab', { + name: `issue.tabs.${TabKeys.Code}`, + selected: true, }) ).toBeInTheDocument(); @@ -551,15 +554,17 @@ it('should show code tabs when any secondary location is selected', async () => screen.getByRole('tab', { name: 'coding_rules.description_section.title.root_cause' }) ); expect( - screen.queryByRole('row', { - name: '2 source_viewer.tooltip.covered import java.util. ArrayList ;', + screen.queryByRole('tab', { + name: `issue.tabs.${TabKeys.Code}`, + selected: true, }) ).not.toBeInTheDocument(); await user.click(screen.getByRole('button', { name: '1 location 1' })); expect( - screen.getByRole('row', { - name: '2 source_viewer.tooltip.covered import java.util. ArrayList ;', + screen.getByRole('tab', { + name: `issue.tabs.${TabKeys.Code}`, + selected: true, }) ).toBeInTheDocument(); }); -- cgit v1.2.3