import SecondaryIssue from '../../../components/issue/SecondaryIssue';
import getCoverageStatus from '../../../components/SourceViewer/helpers/getCoverageStatus';
import { locationsByLine } from '../../../components/SourceViewer/helpers/indexing';
-import SourceViewerHeaderSlim from '../../../components/SourceViewer/SourceViewerHeaderSlim';
import { getBranchLikeQuery } from '../../../helpers/branch-like';
import { BranchLike } from '../../../types/branch-like';
import { isFile } from '../../../types/component';
SourceLine,
SourceViewerFile
} from '../../../types/types';
+import IssueSourceViewerHeader from './IssueSourceViewerHeader';
import SnippetViewer from './SnippetViewer';
import {
createSnippets,
return (
<div className="component-source-container" ref={this.rootNodeRef}>
- <SourceViewerHeaderSlim
+ <IssueSourceViewerHeader
branchLike={branchLike}
expandable={!fullyShown && isFile(snippetGroup.component.q)}
loading={loading}
})}
{locationsByComponent.length === 0 && (
- <ComponentSourceSnippetGroupViewer
- branchLike={this.props.branchLike}
- duplications={duplications}
- duplicationsByLine={duplicationsByLine}
- highlightedLocationMessage={this.props.highlightedLocationMessage}
- issue={issue}
- issuePopup={this.state.issuePopup}
- issuesByLine={issuesByComponent[issue.component] || {}}
- isLastOccurenceOfPrimaryComponent={true}
- lastSnippetGroup={true}
- loadDuplications={this.fetchDuplications}
- locations={[]}
- onIssueChange={this.props.onIssueChange}
- onIssueSelect={this.props.onIssueSelect}
- onIssuePopupToggle={this.handleIssuePopupToggle}
- onLocationSelect={this.props.onLocationSelect}
- renderDuplicationPopup={this.renderDuplicationPopup}
- scroll={this.props.scroll}
- snippetGroup={{
- locations: [getPrimaryLocation(issue)],
- ...components[issue.component]
- }}
- />
+ <SourceViewerContext.Provider
+ value={{
+ branchLike: this.props.branchLike,
+ file: components[issue.component].component
+ }}>
+ <ComponentSourceSnippetGroupViewer
+ branchLike={this.props.branchLike}
+ duplications={duplications}
+ duplicationsByLine={duplicationsByLine}
+ highlightedLocationMessage={this.props.highlightedLocationMessage}
+ issue={issue}
+ issuePopup={this.state.issuePopup}
+ issuesByLine={issuesByComponent[issue.component] || {}}
+ isLastOccurenceOfPrimaryComponent={true}
+ lastSnippetGroup={true}
+ loadDuplications={this.fetchDuplications}
+ locations={[]}
+ onIssueChange={this.props.onIssueChange}
+ onIssueSelect={this.props.onIssueSelect}
+ onIssuePopupToggle={this.handleIssuePopupToggle}
+ onLocationSelect={this.props.onLocationSelect}
+ renderDuplicationPopup={this.renderDuplicationPopup}
+ scroll={this.props.scroll}
+ snippetGroup={{
+ locations: [getPrimaryLocation(issue)],
+ ...components[issue.component]
+ }}
+ />
+ </SourceViewerContext.Provider>
)}
</div>
);
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2022 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+.source-viewer-header-slim {
+ padding: 4px 10px;
+ border: 1px solid var(--gray80);
+ background-color: var(--barBackgroundColor);
+ align-items: center;
+ min-height: 25px;
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2022 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+import classNames from 'classnames';
+import * as React from 'react';
+import { Link } from 'react-router-dom';
+import { ButtonIcon } from '../../../components/controls/buttons';
+import { ClipboardIconButton } from '../../../components/controls/clipboard';
+import ExpandSnippetIcon from '../../../components/icons/ExpandSnippetIcon';
+import QualifierIcon from '../../../components/icons/QualifierIcon';
+import DeferredSpinner from '../../../components/ui/DeferredSpinner';
+import { getBranchLikeQuery } from '../../../helpers/branch-like';
+import { translate } from '../../../helpers/l10n';
+import { collapsedDirFromPath, fileFromPath } from '../../../helpers/path';
+import { getBranchLikeUrl, getComponentIssuesUrl, getPathUrlAsString } from '../../../helpers/urls';
+import { BranchLike } from '../../../types/branch-like';
+import { ComponentQualifier } from '../../../types/component';
+import { SourceViewerFile } from '../../../types/types';
+import './IssueSourceViewerHeader.css';
+
+export interface Props {
+ branchLike: BranchLike | undefined;
+ expandable?: boolean;
+ displayProjectName?: boolean;
+ linkToProject?: boolean;
+ loading?: boolean;
+ onExpand?: () => void;
+ sourceViewerFile: SourceViewerFile;
+}
+
+export default function IssueSourceViewerHeader(props: Props) {
+ const {
+ branchLike,
+ expandable,
+ displayProjectName = true,
+ linkToProject = true,
+ loading,
+ onExpand,
+ sourceViewerFile
+ } = props;
+ const { measures, path, project, projectName, q } = sourceViewerFile;
+
+ const projectNameLabel = (
+ <>
+ <QualifierIcon qualifier={ComponentQualifier.Project} /> <span>{projectName}</span>
+ </>
+ );
+
+ const isProjectRoot = q === ComponentQualifier.Project;
+
+ return (
+ <div className="source-viewer-header-slim display-flex-row display-flex-space-between">
+ <div className="display-flex-center flex-1">
+ {displayProjectName && (
+ <div className="spacer-right">
+ {linkToProject ? (
+ <a
+ className="link-with-icon"
+ href={getPathUrlAsString(getBranchLikeUrl(project, branchLike))}>
+ {projectNameLabel}
+ </a>
+ ) : (
+ projectNameLabel
+ )}
+ </div>
+ )}
+
+ {!isProjectRoot && (
+ <>
+ <div className="spacer-right">
+ <QualifierIcon qualifier={q} /> <span>{collapsedDirFromPath(path)}</span>
+ <span className="component-name-file">{fileFromPath(path)}</span>
+ </div>
+
+ <div className="spacer-right">
+ <ClipboardIconButton className="button-link link-no-underline" copyValue={path} />
+ </div>
+ </>
+ )}
+ </div>
+
+ {!isProjectRoot && measures.issues !== undefined && (
+ <div
+ className={classNames('flex-0 big-spacer-left', {
+ 'little-spacer-right': !expandable || loading
+ })}>
+ <Link
+ to={getComponentIssuesUrl(project, {
+ ...getBranchLikeQuery(branchLike),
+ files: path,
+ resolved: 'false'
+ })}>
+ {translate('source_viewer.view_all_issues')}
+ </Link>
+ </div>
+ )}
+
+ {expandable && (
+ <DeferredSpinner className="little-spacer-right" loading={loading}>
+ <div className="flex-0 big-spacer-left">
+ <ButtonIcon className="js-actions" onClick={onExpand}>
+ <ExpandSnippetIcon />
+ </ButtonIcon>
+ </div>
+ </DeferredSpinner>
+ )}
+ </div>
+ );
+}
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
.snippet {
- margin: var(--gridSize);
+ margin: var(--gridSize) 0;
border: 1px solid var(--gray80);
overflow-x: auto;
overflow-y: hidden;
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2022 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * 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 * as React from 'react';
+import { mockMainBranch } from '../../../../helpers/mocks/branch-like';
+import { mockSourceViewerFile } from '../../../../helpers/mocks/sources';
+import { ComponentQualifier } from '../../../../types/component';
+import IssueSourceViewerHeader, { Props } from '../IssueSourceViewerHeader';
+
+it('should render correctly', () => {
+ expect(shallowRender()).toMatchSnapshot();
+ expect(shallowRender({ linkToProject: false })).toMatchSnapshot('no link to project');
+ expect(shallowRender({ displayProjectName: false })).toMatchSnapshot('no project name');
+ expect(
+ shallowRender({
+ sourceViewerFile: mockSourceViewerFile('foo/bar.ts', 'my-project', {
+ q: ComponentQualifier.Project
+ })
+ })
+ ).toMatchSnapshot('project root');
+});
+
+function shallowRender(props: Partial<Props> = {}) {
+ return shallow(
+ <IssueSourceViewerHeader
+ branchLike={mockMainBranch()}
+ expandable={true}
+ onExpand={jest.fn()}
+ sourceViewerFile={mockSourceViewerFile('foo/bar.ts', 'my-project')}
+ {...props}
+ />
+ );
+}
<div
className="component-source-container"
>
- <SourceViewerHeaderSlim
+ <IssueSourceViewerHeader
branchLike={
Object {
"analysisDate": "2018-01-01",
--- /dev/null
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`should render correctly 1`] = `
+<div
+ className="source-viewer-header-slim display-flex-row display-flex-space-between"
+>
+ <div
+ className="display-flex-center flex-1"
+ >
+ <div
+ className="spacer-right"
+ >
+ <a
+ className="link-with-icon"
+ href="/dashboard?id=my-project"
+ >
+ <QualifierIcon
+ qualifier="TRK"
+ />
+
+ <span>
+ MyProject
+ </span>
+ </a>
+ </div>
+ <div
+ className="spacer-right"
+ >
+ <QualifierIcon
+ qualifier="FIL"
+ />
+
+ <span>
+ foo/
+ </span>
+ <span
+ className="component-name-file"
+ >
+ bar.ts
+ </span>
+ </div>
+ <div
+ className="spacer-right"
+ >
+ <ClipboardIconButton
+ className="button-link link-no-underline"
+ copyValue="foo/bar.ts"
+ />
+ </div>
+ </div>
+ <div
+ className="flex-0 big-spacer-left"
+ >
+ <Link
+ to={
+ Object {
+ "hash": "",
+ "pathname": "/project/issues",
+ "search": "?files=foo%2Fbar.ts&resolved=false&id=my-project",
+ }
+ }
+ >
+ source_viewer.view_all_issues
+ </Link>
+ </div>
+ <DeferredSpinner
+ className="little-spacer-right"
+ >
+ <div
+ className="flex-0 big-spacer-left"
+ >
+ <ButtonIcon
+ className="js-actions"
+ onClick={[MockFunction]}
+ >
+ <ExpandSnippetIcon />
+ </ButtonIcon>
+ </div>
+ </DeferredSpinner>
+</div>
+`;
+
+exports[`should render correctly: no link to project 1`] = `
+<div
+ className="source-viewer-header-slim display-flex-row display-flex-space-between"
+>
+ <div
+ className="display-flex-center flex-1"
+ >
+ <div
+ className="spacer-right"
+ >
+ <QualifierIcon
+ qualifier="TRK"
+ />
+
+ <span>
+ MyProject
+ </span>
+ </div>
+ <div
+ className="spacer-right"
+ >
+ <QualifierIcon
+ qualifier="FIL"
+ />
+
+ <span>
+ foo/
+ </span>
+ <span
+ className="component-name-file"
+ >
+ bar.ts
+ </span>
+ </div>
+ <div
+ className="spacer-right"
+ >
+ <ClipboardIconButton
+ className="button-link link-no-underline"
+ copyValue="foo/bar.ts"
+ />
+ </div>
+ </div>
+ <div
+ className="flex-0 big-spacer-left"
+ >
+ <Link
+ to={
+ Object {
+ "hash": "",
+ "pathname": "/project/issues",
+ "search": "?files=foo%2Fbar.ts&resolved=false&id=my-project",
+ }
+ }
+ >
+ source_viewer.view_all_issues
+ </Link>
+ </div>
+ <DeferredSpinner
+ className="little-spacer-right"
+ >
+ <div
+ className="flex-0 big-spacer-left"
+ >
+ <ButtonIcon
+ className="js-actions"
+ onClick={[MockFunction]}
+ >
+ <ExpandSnippetIcon />
+ </ButtonIcon>
+ </div>
+ </DeferredSpinner>
+</div>
+`;
+
+exports[`should render correctly: no project name 1`] = `
+<div
+ className="source-viewer-header-slim display-flex-row display-flex-space-between"
+>
+ <div
+ className="display-flex-center flex-1"
+ >
+ <div
+ className="spacer-right"
+ >
+ <QualifierIcon
+ qualifier="FIL"
+ />
+
+ <span>
+ foo/
+ </span>
+ <span
+ className="component-name-file"
+ >
+ bar.ts
+ </span>
+ </div>
+ <div
+ className="spacer-right"
+ >
+ <ClipboardIconButton
+ className="button-link link-no-underline"
+ copyValue="foo/bar.ts"
+ />
+ </div>
+ </div>
+ <div
+ className="flex-0 big-spacer-left"
+ >
+ <Link
+ to={
+ Object {
+ "hash": "",
+ "pathname": "/project/issues",
+ "search": "?files=foo%2Fbar.ts&resolved=false&id=my-project",
+ }
+ }
+ >
+ source_viewer.view_all_issues
+ </Link>
+ </div>
+ <DeferredSpinner
+ className="little-spacer-right"
+ >
+ <div
+ className="flex-0 big-spacer-left"
+ >
+ <ButtonIcon
+ className="js-actions"
+ onClick={[MockFunction]}
+ >
+ <ExpandSnippetIcon />
+ </ButtonIcon>
+ </div>
+ </DeferredSpinner>
+</div>
+`;
+
+exports[`should render correctly: project root 1`] = `
+<div
+ className="source-viewer-header-slim display-flex-row display-flex-space-between"
+>
+ <div
+ className="display-flex-center flex-1"
+ >
+ <div
+ className="spacer-right"
+ >
+ <a
+ className="link-with-icon"
+ href="/dashboard?id=my-project"
+ >
+ <QualifierIcon
+ qualifier="TRK"
+ />
+
+ <span>
+ MyProject
+ </span>
+ </a>
+ </div>
+ </div>
+ <DeferredSpinner
+ className="little-spacer-right"
+ >
+ <div
+ className="flex-0 big-spacer-left"
+ >
+ <ButtonIcon
+ className="js-actions"
+ onClick={[MockFunction]}
+ >
+ <ExpandSnippetIcon />
+ </ButtonIcon>
+ </div>
+ </DeferredSpinner>
+</div>
+`;
color: white;
}
-.component-source-container {
- border: 1px solid var(--gray80);
-}
-
.component-source-container + .component-source-container {
margin-top: var(--gridSize);
}
import SourceViewerCode from './SourceViewerCode';
import { SourceViewerContext } from './SourceViewerContext';
import SourceViewerHeader from './SourceViewerHeader';
-import SourceViewerHeaderSlim from './SourceViewerHeaderSlim';
import './styles.css';
export interface Props {
selectedIssue?: string;
showMeasures?: boolean;
metricKey?: string;
- slimHeader?: boolean;
}
interface State {
);
}
- renderHeader(branchLike: BranchLike | undefined, sourceViewerFile: SourceViewerFile) {
- return this.props.slimHeader ? (
- <SourceViewerHeaderSlim branchLike={branchLike} sourceViewerFile={sourceViewerFile} />
- ) : (
+ renderHeader(sourceViewerFile: SourceViewerFile) {
+ return (
<WorkspaceContext.Consumer>
{({ openComponent }) => (
<SourceViewerHeader
return (
<SourceViewerContext.Provider value={{ branchLike: this.props.branchLike, file: component }}>
<div className="source-viewer" ref={node => (this.node = node)}>
- {this.renderHeader(this.props.branchLike, component)}
+ {this.renderHeader(component)}
{sourceRemoved && (
<Alert className="spacer-top" variant="warning">
{translate('code_viewer.no_source_code_displayed_due_to_source_removed')}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2022 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-.source-viewer-header-slim {
- padding: 4px 10px 4px;
- border-bottom: 1px solid var(--gray80);
- background-color: var(--barBackgroundColor);
- align-items: center;
- min-height: 25px;
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2022 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import classNames from 'classnames';
-import * as React from 'react';
-import { Link } from 'react-router-dom';
-import { ButtonIcon } from '../../components/controls/buttons';
-import { ClipboardIconButton } from '../../components/controls/clipboard';
-import ExpandSnippetIcon from '../../components/icons/ExpandSnippetIcon';
-import QualifierIcon from '../../components/icons/QualifierIcon';
-import DeferredSpinner from '../../components/ui/DeferredSpinner';
-import { getBranchLikeQuery } from '../../helpers/branch-like';
-import { translate } from '../../helpers/l10n';
-import { collapsedDirFromPath, fileFromPath } from '../../helpers/path';
-import { getBranchLikeUrl, getComponentIssuesUrl, getPathUrlAsString } from '../../helpers/urls';
-import { BranchLike } from '../../types/branch-like';
-import { ComponentQualifier } from '../../types/component';
-import { SourceViewerFile } from '../../types/types';
-import './SourceViewerHeaderSlim.css';
-
-export interface Props {
- branchLike: BranchLike | undefined;
- expandable?: boolean;
- displayProjectName?: boolean;
- linkToProject?: boolean;
- loading?: boolean;
- onExpand?: () => void;
- sourceViewerFile: SourceViewerFile;
-}
-
-export default function SourceViewerHeaderSlim(props: Props) {
- const {
- branchLike,
- expandable,
- displayProjectName = true,
- linkToProject = true,
- loading,
- onExpand,
- sourceViewerFile
- } = props;
- const { measures, path, project, projectName, q } = sourceViewerFile;
-
- const projectNameLabel = (
- <>
- <QualifierIcon qualifier={ComponentQualifier.Project} /> <span>{projectName}</span>
- </>
- );
-
- const isProjectRoot = q === ComponentQualifier.Project;
-
- return (
- <div className="source-viewer-header-slim display-flex-row display-flex-space-between">
- <div className="display-flex-center flex-1">
- {displayProjectName && (
- <div className="spacer-right">
- {linkToProject ? (
- <a
- className="link-with-icon"
- href={getPathUrlAsString(getBranchLikeUrl(project, branchLike))}>
- {projectNameLabel}
- </a>
- ) : (
- projectNameLabel
- )}
- </div>
- )}
-
- {!isProjectRoot && (
- <>
- <div className="spacer-right">
- <QualifierIcon qualifier={q} /> <span>{collapsedDirFromPath(path)}</span>
- <span className="component-name-file">{fileFromPath(path)}</span>
- </div>
-
- <div className="spacer-right">
- <ClipboardIconButton className="button-link link-no-underline" copyValue={path} />
- </div>
- </>
- )}
- </div>
-
- {!isProjectRoot && measures.issues !== undefined && (
- <div
- className={classNames('flex-0 big-spacer-left', {
- 'little-spacer-right': !expandable || loading
- })}>
- <Link
- to={getComponentIssuesUrl(project, {
- ...getBranchLikeQuery(branchLike),
- files: path,
- resolved: 'false'
- })}>
- {translate('source_viewer.view_all_issues')}
- </Link>
- </div>
- )}
-
- {expandable && (
- <DeferredSpinner className="little-spacer-right" loading={loading}>
- <div className="flex-0 big-spacer-left">
- <ButtonIcon className="js-actions" onClick={onExpand}>
- <ExpandSnippetIcon />
- </ButtonIcon>
- </div>
- </DeferredSpinner>
- )}
- </div>
- );
-}
onLoaded={jest.fn()}
onLocationSelect={jest.fn()}
scroll={jest.fn()}
- slimHeader={true}
{...override}
/>
);
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2022 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * 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 * as React from 'react';
-import { mockMainBranch } from '../../../helpers/mocks/branch-like';
-import { mockSourceViewerFile } from '../../../helpers/mocks/sources';
-import { ComponentQualifier } from '../../../types/component';
-import SourceViewerHeaderSlim, { Props } from '../SourceViewerHeaderSlim';
-
-it('should render correctly', () => {
- expect(shallowRender()).toMatchSnapshot();
- expect(shallowRender({ linkToProject: false })).toMatchSnapshot('no link to project');
- expect(shallowRender({ displayProjectName: false })).toMatchSnapshot('no project name');
- expect(
- shallowRender({
- sourceViewerFile: mockSourceViewerFile('foo/bar.ts', 'my-project', {
- q: ComponentQualifier.Project
- })
- })
- ).toMatchSnapshot('project root');
-});
-
-function shallowRender(props: Partial<Props> = {}) {
- return shallow(
- <SourceViewerHeaderSlim
- branchLike={mockMainBranch()}
- expandable={true}
- onExpand={jest.fn()}
- sourceViewerFile={mockSourceViewerFile('foo/bar.ts', 'my-project')}
- {...props}
- />
- );
-}
+++ /dev/null
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should render correctly 1`] = `
-<div
- className="source-viewer-header-slim display-flex-row display-flex-space-between"
->
- <div
- className="display-flex-center flex-1"
- >
- <div
- className="spacer-right"
- >
- <a
- className="link-with-icon"
- href="/dashboard?id=my-project"
- >
- <QualifierIcon
- qualifier="TRK"
- />
-
- <span>
- MyProject
- </span>
- </a>
- </div>
- <div
- className="spacer-right"
- >
- <QualifierIcon
- qualifier="FIL"
- />
-
- <span>
- foo/
- </span>
- <span
- className="component-name-file"
- >
- bar.ts
- </span>
- </div>
- <div
- className="spacer-right"
- >
- <ClipboardIconButton
- className="button-link link-no-underline"
- copyValue="foo/bar.ts"
- />
- </div>
- </div>
- <div
- className="flex-0 big-spacer-left"
- >
- <Link
- to={
- Object {
- "hash": "",
- "pathname": "/project/issues",
- "search": "?files=foo%2Fbar.ts&resolved=false&id=my-project",
- }
- }
- >
- source_viewer.view_all_issues
- </Link>
- </div>
- <DeferredSpinner
- className="little-spacer-right"
- >
- <div
- className="flex-0 big-spacer-left"
- >
- <ButtonIcon
- className="js-actions"
- onClick={[MockFunction]}
- >
- <ExpandSnippetIcon />
- </ButtonIcon>
- </div>
- </DeferredSpinner>
-</div>
-`;
-
-exports[`should render correctly: no link to project 1`] = `
-<div
- className="source-viewer-header-slim display-flex-row display-flex-space-between"
->
- <div
- className="display-flex-center flex-1"
- >
- <div
- className="spacer-right"
- >
- <QualifierIcon
- qualifier="TRK"
- />
-
- <span>
- MyProject
- </span>
- </div>
- <div
- className="spacer-right"
- >
- <QualifierIcon
- qualifier="FIL"
- />
-
- <span>
- foo/
- </span>
- <span
- className="component-name-file"
- >
- bar.ts
- </span>
- </div>
- <div
- className="spacer-right"
- >
- <ClipboardIconButton
- className="button-link link-no-underline"
- copyValue="foo/bar.ts"
- />
- </div>
- </div>
- <div
- className="flex-0 big-spacer-left"
- >
- <Link
- to={
- Object {
- "hash": "",
- "pathname": "/project/issues",
- "search": "?files=foo%2Fbar.ts&resolved=false&id=my-project",
- }
- }
- >
- source_viewer.view_all_issues
- </Link>
- </div>
- <DeferredSpinner
- className="little-spacer-right"
- >
- <div
- className="flex-0 big-spacer-left"
- >
- <ButtonIcon
- className="js-actions"
- onClick={[MockFunction]}
- >
- <ExpandSnippetIcon />
- </ButtonIcon>
- </div>
- </DeferredSpinner>
-</div>
-`;
-
-exports[`should render correctly: no project name 1`] = `
-<div
- className="source-viewer-header-slim display-flex-row display-flex-space-between"
->
- <div
- className="display-flex-center flex-1"
- >
- <div
- className="spacer-right"
- >
- <QualifierIcon
- qualifier="FIL"
- />
-
- <span>
- foo/
- </span>
- <span
- className="component-name-file"
- >
- bar.ts
- </span>
- </div>
- <div
- className="spacer-right"
- >
- <ClipboardIconButton
- className="button-link link-no-underline"
- copyValue="foo/bar.ts"
- />
- </div>
- </div>
- <div
- className="flex-0 big-spacer-left"
- >
- <Link
- to={
- Object {
- "hash": "",
- "pathname": "/project/issues",
- "search": "?files=foo%2Fbar.ts&resolved=false&id=my-project",
- }
- }
- >
- source_viewer.view_all_issues
- </Link>
- </div>
- <DeferredSpinner
- className="little-spacer-right"
- >
- <div
- className="flex-0 big-spacer-left"
- >
- <ButtonIcon
- className="js-actions"
- onClick={[MockFunction]}
- >
- <ExpandSnippetIcon />
- </ButtonIcon>
- </div>
- </DeferredSpinner>
-</div>
-`;
-
-exports[`should render correctly: project root 1`] = `
-<div
- className="source-viewer-header-slim display-flex-row display-flex-space-between"
->
- <div
- className="display-flex-center flex-1"
- >
- <div
- className="spacer-right"
- >
- <a
- className="link-with-icon"
- href="/dashboard?id=my-project"
- >
- <QualifierIcon
- qualifier="TRK"
- />
-
- <span>
- MyProject
- </span>
- </a>
- </div>
- </div>
- <DeferredSpinner
- className="little-spacer-right"
- >
- <div
- className="flex-0 big-spacer-left"
- >
- <ButtonIcon
- className="js-actions"
- onClick={[MockFunction]}
- >
- <ExpandSnippetIcon />
- </ButtonIcon>
- </div>
- </DeferredSpinner>
-</div>
-`;
issue.comment.edit=Edit comment
issue.comment.delete=Delete comment
issue.comment.delete_confirm_message=Do you want to delete this comment?
+issue.get_permalink=Get Permalink
issue.manual_vulnerability=Manual
issue.manual_vulnerability.description=This Vulnerability was created from a Security Hotspot and has its own issue workflow.
issue.rule_details=Rule Details