From: Wouter Admiraal Date: Thu, 28 Jul 2022 09:58:24 +0000 (+0200) Subject: SONAR-16703 [891618] Visual heading text is not marked as heading X-Git-Tag: 9.6.0.59041~117 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=28e97acc55006a33470cd025d802f7e08482c3f7;p=sonarqube.git SONAR-16703 [891618] Visual heading text is not marked as heading --- diff --git a/server/sonar-web/src/main/js/app/components/nav/component/Breadcrumb.tsx b/server/sonar-web/src/main/js/app/components/nav/component/Breadcrumb.tsx index f96ee9b78d0..d00315089d1 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/Breadcrumb.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/component/Breadcrumb.tsx @@ -26,12 +26,12 @@ import { getComponentOverviewUrl } from '../../../../helpers/urls'; import { BranchLike } from '../../../../types/branch-like'; import { Component } from '../../../../types/types'; -interface Props { +export interface BreadcrumbProps { component: Component; currentBranchLike: BranchLike | undefined; } -export function Breadcrumb(props: Props) { +export function Breadcrumb(props: BreadcrumbProps) { const { component: { breadcrumbs }, currentBranchLike @@ -51,16 +51,18 @@ export function Breadcrumb(props: Props) { )} {isNoMainBranch || isNotLast ? ( - - {breadcrumbElement.name} - +

+ + {breadcrumbElement.name} + +

) : ( - +

{breadcrumbElement.name} - +

)} {isNotLast && } diff --git a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/Breadcrumb-test.tsx b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/Breadcrumb-test.tsx index d745c37d74c..4d67b48719c 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/Breadcrumb-test.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/Breadcrumb-test.tsx @@ -17,36 +17,44 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import { shallow } from 'enzyme'; +import { screen } from '@testing-library/react'; import * as React from 'react'; -import { mockMainBranch } from '../../../../../helpers/mocks/branch-like'; +import { mockBranch, mockMainBranch } from '../../../../../helpers/mocks/branch-like'; import { mockComponent } from '../../../../../helpers/mocks/component'; +import { renderComponent } from '../../../../../helpers/testReactTestingUtils'; import { ComponentQualifier } from '../../../../../types/component'; -import { Breadcrumb } from '../Breadcrumb'; +import { Breadcrumb, BreadcrumbProps } from '../Breadcrumb'; it('should render correctly', () => { - const wrapper = shallowRender(); - expect(wrapper).toMatchSnapshot(); + renderBreadcrumb(); + expect(screen.getByRole('link', { name: 'Parent portfolio' })).toBeInTheDocument(); + expect(screen.getByRole('heading', { name: 'Child portfolio' })).toBeInTheDocument(); }); -function shallowRender() { - return shallow( +it('should render correctly when not on a main branch', () => { + renderBreadcrumb({ currentBranchLike: mockBranch() }); + expect(screen.getByRole('link', { name: 'Child portfolio' })).toBeInTheDocument(); +}); + +function renderBreadcrumb(props: Partial = {}) { + return renderComponent( ); } diff --git a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/Breadcrumb-test.tsx.snap b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/Breadcrumb-test.tsx.snap deleted file mode 100644 index e78e2c5452a..00000000000 --- a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/Breadcrumb-test.tsx.snap +++ /dev/null @@ -1,43 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly 1`] = ` -
- - - - parent-portfolio - - - - - - child-portfolio - - -
-`; diff --git a/server/sonar-web/src/main/js/components/tutorials/TutorialSelectionRenderer.tsx b/server/sonar-web/src/main/js/components/tutorials/TutorialSelectionRenderer.tsx index 2370fa05b45..f08f088b801 100644 --- a/server/sonar-web/src/main/js/components/tutorials/TutorialSelectionRenderer.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/TutorialSelectionRenderer.tsx @@ -113,9 +113,9 @@ export default function TutorialSelectionRenderer(props: TutorialSelectionRender <> {selectedTutorial === undefined && ( <> -

+

{translate('onboarding.tutorial.choose_method')} -

+

diff --git a/server/sonar-web/src/main/js/components/tutorials/__tests__/__snapshots__/TutorialSelectionRenderer-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/__tests__/__snapshots__/TutorialSelectionRenderer-test.tsx.snap index 28cd916f7a1..0b023b704df 100644 --- a/server/sonar-web/src/main/js/components/tutorials/__tests__/__snapshots__/TutorialSelectionRenderer-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/tutorials/__tests__/__snapshots__/TutorialSelectionRenderer-test.tsx.snap @@ -2,11 +2,11 @@ exports[`should render correctly for azure 1`] = ` -

onboarding.tutorial.choose_method -

+
@@ -78,11 +78,11 @@ exports[`should render correctly for azure 1`] = ` exports[`should render correctly for bitbucket server 1`] = ` -

onboarding.tutorial.choose_method -

+
@@ -154,11 +154,11 @@ exports[`should render correctly for bitbucket server 1`] = ` exports[`should render correctly for github 1`] = ` -

onboarding.tutorial.choose_method -

+
@@ -263,11 +263,11 @@ exports[`should render correctly for github 1`] = ` exports[`should render correctly for gitlab 1`] = ` -

onboarding.tutorial.choose_method -

+
@@ -590,11 +590,11 @@ exports[`should render correctly: manual tutorial 1`] = ` exports[`should render correctly: selection 1`] = ` -

onboarding.tutorial.choose_method -

+
diff --git a/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/AzurePipelinesTutorial.tsx b/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/AzurePipelinesTutorial.tsx index c42e621e248..5f07e2347aa 100644 --- a/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/AzurePipelinesTutorial.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/AzurePipelinesTutorial.tsx @@ -91,9 +91,9 @@ export default function AzurePipelinesTutorial(props: AzurePipelinesTutorialProp return ( <>
-

+

{translate('onboarding.tutorial.with.azure_pipelines.title')} -

+
{steps.map((step, i) => ( diff --git a/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/__tests__/__snapshots__/AzurePipelinesTutorial-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/__tests__/__snapshots__/AzurePipelinesTutorial-test.tsx.snap index f1f1573b62e..c180cb824f8 100644 --- a/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/__tests__/__snapshots__/AzurePipelinesTutorial-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/__tests__/__snapshots__/AzurePipelinesTutorial-test.tsx.snap @@ -5,11 +5,11 @@ exports[`should render correctly 1`] = `
-

onboarding.tutorial.with.azure_pipelines.title -

+
-

{translate('onboarding.tutorial.with.gitlab_ci.title')}

+

{translate('onboarding.tutorial.with.gitlab_ci.title')}

-

onboarding.tutorial.with.gitlab_ci.title -

+
-

{translate('onboarding.tutorial.with.jenkins.title')}

+

{translate('onboarding.tutorial.with.jenkins.title')}

{hasSelectAlmStep && ( diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/__snapshots__/JenkinsTutorial-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/__snapshots__/JenkinsTutorial-test.tsx.snap index 7c2907baa6c..925ce8e6375 100644 --- a/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/__snapshots__/JenkinsTutorial-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/__snapshots__/JenkinsTutorial-test.tsx.snap @@ -5,11 +5,11 @@ exports[`should render correctly: branches not enabled 1`] = `
-

onboarding.tutorial.with.jenkins.title -

+
-

onboarding.tutorial.with.jenkins.title -

+
-

onboarding.tutorial.with.jenkins.title -

+
{ return ( <>
-

{translate('onboarding.project_analysis.header')}

+

{translate('onboarding.project_analysis.header')}

diff --git a/server/sonar-web/src/main/js/components/tutorials/other/__tests__/__snapshots__/OtherTutorial-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/other/__tests__/__snapshots__/OtherTutorial-test.tsx.snap index 39298e06e95..cdec8d32ea8 100644 --- a/server/sonar-web/src/main/js/components/tutorials/other/__tests__/__snapshots__/OtherTutorial-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/tutorials/other/__tests__/__snapshots__/OtherTutorial-test.tsx.snap @@ -5,11 +5,11 @@ exports[`renders correctly: default 1`] = `
-

onboarding.project_analysis.header -

+

diff --git a/server/sonar-web/src/main/js/components/ui/NavBar.css b/server/sonar-web/src/main/js/components/ui/NavBar.css index fc0de133378..1259a60d338 100644 --- a/server/sonar-web/src/main/js/components/ui/NavBar.css +++ b/server/sonar-web/src/main/js/components/ui/NavBar.css @@ -29,6 +29,10 @@ right: 0; } +.navbar-inner h1 { + line-height: inherit; +} + .navbar-inner > div { position: relative; min-width: var(--minPageWidth);