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
<QualifierIcon className="spacer-right" qualifier={lastBreadcrumbElement.qualifier} />
)}
{isNoMainBranch || isNotLast ? (
- <Link
- className="link-no-underline text-ellipsis"
- title={breadcrumbElement.name}
- to={getComponentOverviewUrl(breadcrumbElement.key, breadcrumbElement.qualifier)}>
- {breadcrumbElement.name}
- </Link>
+ <h1>
+ <Link
+ className="link-no-underline text-ellipsis"
+ title={breadcrumbElement.name}
+ to={getComponentOverviewUrl(breadcrumbElement.key, breadcrumbElement.qualifier)}>
+ {breadcrumbElement.name}
+ </Link>
+ </h1>
) : (
- <span className="text-ellipsis" title={breadcrumbElement.name}>
+ <h1 className="text-ellipsis" title={breadcrumbElement.name}>
{breadcrumbElement.name}
- </span>
+ </h1>
)}
{isNotLast && <span className="slash-separator" />}
</span>
* 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<BreadcrumbProps> = {}) {
+ return renderComponent(
<Breadcrumb
component={mockComponent({
breadcrumbs: [
{
key: 'parent-portfolio',
- name: 'parent-portfolio',
+ name: 'Parent portfolio',
qualifier: ComponentQualifier.Portfolio
},
{
key: 'child-portfolio',
- name: 'child-portfolio',
+ name: 'Child portfolio',
qualifier: ComponentQualifier.SubPortfolio
}
]
})}
currentBranchLike={mockMainBranch()}
+ {...props}
/>
);
}
+++ /dev/null
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should render correctly 1`] = `
-<div
- className="big flex-shrink display-flex-center"
->
- <span
- className="flex-shrink display-flex-center"
- key="parent-portfolio"
- >
- <QualifierIcon
- className="spacer-right"
- qualifier="SVW"
- />
- <Link
- className="link-no-underline text-ellipsis"
- title="parent-portfolio"
- to={
- Object {
- "pathname": "/portfolio",
- "search": "?id=parent-portfolio",
- }
- }
- >
- parent-portfolio
- </Link>
- <span
- className="slash-separator"
- />
- </span>
- <span
- className="flex-shrink display-flex-center"
- key="child-portfolio"
- >
- <span
- className="text-ellipsis"
- title="child-portfolio"
- >
- child-portfolio
- </span>
- </span>
-</div>
-`;
<>
{selectedTutorial === undefined && (
<>
- <h1 className="spacer-top huge-spacer-bottom">
+ <h2 className="spacer-top huge-spacer-bottom">
{translate('onboarding.tutorial.choose_method')}
- </h1>
+ </h2>
<div className="tutorial-selection">
<p className="big-spacer-bottom">
exports[`should render correctly for azure 1`] = `
<Fragment>
- <h1
+ <h2
className="spacer-top huge-spacer-bottom"
>
onboarding.tutorial.choose_method
- </h1>
+ </h2>
<div
className="tutorial-selection"
>
exports[`should render correctly for bitbucket server 1`] = `
<Fragment>
- <h1
+ <h2
className="spacer-top huge-spacer-bottom"
>
onboarding.tutorial.choose_method
- </h1>
+ </h2>
<div
className="tutorial-selection"
>
exports[`should render correctly for github 1`] = `
<Fragment>
- <h1
+ <h2
className="spacer-top huge-spacer-bottom"
>
onboarding.tutorial.choose_method
- </h1>
+ </h2>
<div
className="tutorial-selection"
>
exports[`should render correctly for gitlab 1`] = `
<Fragment>
- <h1
+ <h2
className="spacer-top huge-spacer-bottom"
>
onboarding.tutorial.choose_method
- </h1>
+ </h2>
<div
className="tutorial-selection"
>
exports[`should render correctly: selection 1`] = `
<Fragment>
- <h1
+ <h2
className="spacer-top huge-spacer-bottom"
>
onboarding.tutorial.choose_method
- </h1>
+ </h2>
<div
className="tutorial-selection"
>
return (
<>
<div className="page-header big-spacer-bottom">
- <h1 className="page-title">
+ <h2 className="page-title">
{translate('onboarding.tutorial.with.azure_pipelines.title')}
- </h1>
+ </h2>
</div>
{steps.map((step, i) => (
<div
className="page-header big-spacer-bottom"
>
- <h1
+ <h2
className="page-title"
>
onboarding.tutorial.with.azure_pipelines.title
- </h1>
+ </h2>
</div>
<Step
finished={false}
return (
<>
<div className="page-header big-spacer-bottom">
- <h1 className="page-title">{translate('onboarding.tutorial.with.gitlab_ci.title')}</h1>
+ <h2 className="page-title">{translate('onboarding.tutorial.with.gitlab_ci.title')}</h2>
</div>
<ProjectKeyStep
<div
className="page-header big-spacer-bottom"
>
- <h1
+ <h2
className="page-title"
>
onboarding.tutorial.with.gitlab_ci.title
- </h1>
+ </h2>
</div>
<withCLanguageFeature(ProjectKeyStep)
component={
return (
<>
<div className="page-header big-spacer-bottom">
- <h1 className="page-title">{translate('onboarding.tutorial.with.jenkins.title')}</h1>
+ <h2 className="page-title">{translate('onboarding.tutorial.with.jenkins.title')}</h2>
</div>
{hasSelectAlmStep && (
<div
className="page-header big-spacer-bottom"
>
- <h1
+ <h2
className="page-title"
>
onboarding.tutorial.with.jenkins.title
- </h1>
+ </h2>
</div>
<PreRequisitesStep
alm="bitbucket"
<div
className="page-header big-spacer-bottom"
>
- <h1
+ <h2
className="page-title"
>
onboarding.tutorial.with.jenkins.title
- </h1>
+ </h2>
</div>
<PreRequisitesStep
alm="bitbucket"
<div
className="page-header big-spacer-bottom"
>
- <h1
+ <h2
className="page-title"
>
onboarding.tutorial.with.jenkins.title
- </h1>
+ </h2>
</div>
<SelectAlmStep
onCheck={[Function]}
return (
<>
<div className="page-header big-spacer-bottom">
- <h1 className="page-title">{translate('onboarding.project_analysis.header')}</h1>
+ <h2 className="page-title">{translate('onboarding.project_analysis.header')}</h2>
<p className="page-description">
<InstanceMessage message={translate('onboarding.project_analysis.description')} />
</p>
<div
className="page-header big-spacer-bottom"
>
- <h1
+ <h2
className="page-title"
>
onboarding.project_analysis.header
- </h1>
+ </h2>
<p
className="page-description"
>
right: 0;
}
+.navbar-inner h1 {
+ line-height: inherit;
+}
+
.navbar-inner > div {
position: relative;
min-width: var(--minPageWidth);