+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2018 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 * as React from 'react';
-import ClipboardButton from '../../../components/controls/ClipboardButton';
-
-interface Props {
- snippet: string;
-}
-
-export default function BadgeSnippet({ snippet }: Props) {
- return (
- <div className="badge-snippet">
- <pre>{snippet}</pre>
- <ClipboardButton copyValue={snippet} tooltipPlacement="top" />
- </div>
- );
-}
*/
import * as React from 'react';
import BadgeButton from './BadgeButton';
-import BadgeSnippet from './BadgeSnippet';
import BadgeParams from './BadgeParams';
import { BadgeType, BadgeOptions, getBadgeUrl } from './utils';
import { Metric } from '../../../app/types';
+import CodeSnippet from '../../../components/common/CodeSnippet';
import Modal from '../../../components/controls/Modal';
import { translate } from '../../../helpers/l10n';
import './styles.css';
type={selectedType}
updateOptions={this.handleUpdateOptions}
/>
- <BadgeSnippet snippet={getBadgeUrl(selectedType, fullBadgeOptions)} />
+ <CodeSnippet isOneLine={true} snippet={getBadgeUrl(selectedType, fullBadgeOptions)} />
</div>
<footer className="modal-foot">
<ResetButtonLink className="js-modal-close" onClick={this.handleClose}>
type="measure"
updateOptions={[Function]}
/>
- <BadgeSnippet
+ <CodeSnippet
+ isOneLine={true}
snippet="host/api/project_badges/measure?branch=branch-6.6&project=foo&metric=alert_status"
/>
</div>
background-color: var(--lightBlue);
border-color: var(--darkBlue);
}
-
-.badge-snippet {
- position: relative;
- margin: var(--gridSize) 0;
- background: var(--gray40);
- color: var(--snippetFontColor);
- border-radius: 3px;
-}
-
-.badge-snippet pre {
- padding: calc(2 * var(--gridSize));
- padding-bottom: 40px;
- overflow: auto;
-}
-
-.badge-snippet button {
- position: absolute;
- top: auto;
- top: 40px;
- right: calc(2 * var(--gridSize));
- height: var(--smallControlHeight);
- line-height: 18px;
- border: 1px solid #fff;
- color: #fff;
- font-size: 11px;
- font-weight: normal;
- user-select: none;
-}
-
-.badge-snippet button:hover,
-.badge-snippet button:focus,
-.badge-snippet button:active {
- background-color: #fff;
- color: var(--gray40);
-}
*/
// @flow
import React from 'react';
-import Command from './Command';
import SQScanner from './SQScanner';
import BuildWrapper from './BuildWrapper';
+import CodeSnippet from '../../../../components/common/CodeSnippet';
import { translate } from '../../../../helpers/l10n';
/*::
__html: translate('onboarding.analysis.sq_scanner.execute.text')
}}
/>
- <Command command={command1} isOneLine={true} />
- <Command command={command2} isOneLine={props.os === 'win'} />
+ <CodeSnippet isOneLine={true} snippet={command1} />
+ <CodeSnippet isOneLine={props.os === 'win'} snippet={command2} />
<p
className="big-spacer-top markdown"
dangerouslySetInnerHTML={{ __html: translate('onboarding.analysis.sq_scanner.docs') }}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2018 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.
- */
-// @flow
-import React from 'react';
-import classNames from 'classnames';
-import ClipboardButton from '../../../../components/controls/ClipboardButton';
-import { translate } from '../../../../helpers/l10n';
-
-/*::
-type Props = {
- command: string | Array<?string>,
- isOneLine?: boolean
-};
-*/
-
-// keep this "useless" concatentation for the readability reason
-// eslint-disable-next-line no-useless-concat
-const s = ' \\' + '\n ';
-
-export default class Command extends React.PureComponent {
- /*:: props: Props; */
-
- render() {
- const { command, isOneLine } = this.props;
- const commandArray = Array.isArray(command) ? command.filter(line => line != null) : [command];
- const finalCommand = isOneLine ? commandArray.join(' ') : commandArray.join(s);
-
- return (
- <div
- className={classNames('onboarding-command', { 'onboarding-command-oneline': isOneLine })}>
- <pre>{finalCommand}</pre>
- <ClipboardButton copyValue={finalCommand} tooltipPlacement="top" />
- </div>
- );
- }
-}
*/
// @flow
import React from 'react';
-import Command from './Command';
import MSBuildScanner from './MSBuildScanner';
+import CodeSnippet from '../../../../components/common/CodeSnippet';
import { translate } from '../../../../helpers/l10n';
/*::
__html: translate('onboarding.analysis.msbuild.execute.text')
}}
/>
- <Command command={command1} isOneLine={true} />
- <Command command={command2} isOneLine={true} />
- <Command command={command3} isOneLine={true} />
+ <CodeSnippet isOneLine={true} snippet={command1} />
+ <CodeSnippet isOneLine={true} snippet={command2} />
+ <CodeSnippet isOneLine={true} snippet={command3} />
<p
className="big-spacer-top markdown"
dangerouslySetInnerHTML={{ __html: translate('onboarding.analysis.msbuild.docs') }}
*/
// @flow
import React from 'react';
-import Command from './Command';
+import CodeSnippet from '../../../../components/common/CodeSnippet';
import { translate } from '../../../../helpers/l10n';
/*::
className="spacer-bottom markdown"
dangerouslySetInnerHTML={{ __html: translate('onboarding.analysis.java.gradle.text.1') }}
/>
- <Command command={config} />
+ <CodeSnippet snippet={config} />
<p className="spacer-top spacer-bottom markdown">
{translate('onboarding.analysis.java.gradle.text.2')}
</p>
- <Command command={command} />
+ <CodeSnippet snippet={command} />
<p
className="big-spacer-top markdown"
dangerouslySetInnerHTML={{ __html: translate('onboarding.analysis.java.gradle.docs') }}
*/
// @flow
import React from 'react';
-import Command from './Command';
+import CodeSnippet from '../../../../components/common/CodeSnippet';
import { translate } from '../../../../helpers/l10n';
/*::
<div>
<h4 className="spacer-bottom">{translate('onboarding.analysis.java.maven.header')}</h4>
<p className="spacer-bottom markdown">{translate('onboarding.analysis.java.maven.text')}</p>
- <Command command={command} />
+ <CodeSnippet snippet={command} />
<p
className="big-spacer-top markdown"
dangerouslySetInnerHTML={{ __html: translate('onboarding.analysis.java.maven.docs') }}
*/
// @flow
import React from 'react';
-import Command from './Command';
import MSBuildScanner from './MSBuildScanner';
import BuildWrapper from './BuildWrapper';
+import CodeSnippet from '../../../../components/common/CodeSnippet';
import { translate } from '../../../../helpers/l10n';
/*::
__html: translate('onboarding.analysis.msbuild.execute.text')
}}
/>
- <Command command={command1} isOneLine={true} />
- <Command command={command2} isOneLine={true} />
- <Command command={command3} isOneLine={true} />
+ <CodeSnippet isOneLine={true} snippet={command1} />
+ <CodeSnippet isOneLine={true} snippet={command2} />
+ <CodeSnippet isOneLine={true} snippet={command3} />
<p
className="big-spacer-top markdown"
dangerouslySetInnerHTML={{ __html: translate('onboarding.analysis.msbuild.docs') }}
*/
// @flow
import React from 'react';
-import Command from './Command';
import SQScanner from './SQScanner';
+import CodeSnippet from '../../../../components/common/CodeSnippet';
import { translate } from '../../../../helpers/l10n';
/*::
__html: translate('onboarding.analysis.sq_scanner.execute.text')
}}
/>
- <Command command={command} isOneLine={props.os === 'win'} />
+ <CodeSnippet isOneLine={props.os === 'win'} snippet={command} />
<p
className="big-spacer-top markdown"
dangerouslySetInnerHTML={{ __html: translate('onboarding.analysis.sq_scanner.docs') }}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2018 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.
- */
-// @flow
-import React from 'react';
-import { mount } from 'enzyme';
-import Command from '../Command';
-
-it('renders correctly', () => {
- expect(mount(<Command command={'foo\nbar'} />)).toMatchSnapshot();
-});
}
}
/>
- <Command
- command="build-wrapper-win-x86-64.exe --out-dir bw-output make clean all"
+ <CodeSnippet
isOneLine={true}
+ snippet="build-wrapper-win-x86-64.exe --out-dir bw-output make clean all"
/>
- <Command
- command={
+ <CodeSnippet
+ isOneLine={true}
+ snippet={
Array [
"sonar-scanner.bat",
"-Dsonar.projectKey=projectKey",
"-Dsonar.login=token",
]
}
- isOneLine={true}
/>
<p
className="big-spacer-top markdown"
}
}
/>
- <Command
- command="build-wrapper-linux-x86-64 --out-dir bw-output make clean all"
+ <CodeSnippet
isOneLine={true}
+ snippet="build-wrapper-linux-x86-64 --out-dir bw-output make clean all"
/>
- <Command
- command={
+ <CodeSnippet
+ isOneLine={false}
+ snippet={
Array [
"sonar-scanner",
"-Dsonar.projectKey=projectKey",
"-Dsonar.login=token",
]
}
- isOneLine={false}
/>
<p
className="big-spacer-top markdown"
}
}
/>
- <Command
- command="build-wrapper-linux-x86-64 --out-dir bw-output make clean all"
+ <CodeSnippet
isOneLine={true}
+ snippet="build-wrapper-linux-x86-64 --out-dir bw-output make clean all"
/>
- <Command
- command={
+ <CodeSnippet
+ isOneLine={false}
+ snippet={
Array [
"sonar-scanner",
"-Dsonar.projectKey=projectKey",
"-Dsonar.login=token",
]
}
- isOneLine={false}
/>
<p
className="big-spacer-top markdown"
+++ /dev/null
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`renders correctly 1`] = `
-<Command
- command="foo
-bar"
->
- <div
- className="onboarding-command"
- >
- <pre>
- foo
-bar
- </pre>
- <ClipboardButton
- copyValue="foo
-bar"
- tooltipPlacement="top"
- >
- <Button
- className="js-copy-to-clipboard no-select"
- data-clipboard-text="foo
-bar"
- innerRef={[Function]}
- >
- <button
- className="button js-copy-to-clipboard no-select"
- data-clipboard-text="foo
-bar"
- onClick={[Function]}
- type="button"
- >
- copy
- </button>
- </Button>
- </ClipboardButton>
- </div>
-</Command>
-`;
}
}
/>
- <Command
- command={
+ <CodeSnippet
+ isOneLine={true}
+ snippet={
Array [
"SonarQube.Scanner.MSBuild.exe begin",
"/k:\\"projectKey\\"",
"/d:sonar.login=\\"token\\"",
]
}
- isOneLine={true}
/>
- <Command
- command="MsBuild.exe /t:Rebuild"
+ <CodeSnippet
isOneLine={true}
+ snippet="MsBuild.exe /t:Rebuild"
/>
- <Command
- command={
+ <CodeSnippet
+ isOneLine={true}
+ snippet={
Array [
"SonarQube.Scanner.MSBuild.exe end",
"/d:sonar.login=\\"token\\"",
]
}
- isOneLine={true}
/>
<p
className="big-spacer-top markdown"
}
}
/>
- <Command
- command={
+ <CodeSnippet
+ isOneLine={true}
+ snippet={
Array [
"SonarQube.Scanner.MSBuild.exe begin",
"/k:\\"projectKey\\"",
"/d:sonar.login=\\"token\\"",
]
}
- isOneLine={true}
/>
- <Command
- command="MsBuild.exe /t:Rebuild"
+ <CodeSnippet
isOneLine={true}
+ snippet="MsBuild.exe /t:Rebuild"
/>
- <Command
- command={
+ <CodeSnippet
+ isOneLine={true}
+ snippet={
Array [
"SonarQube.Scanner.MSBuild.exe end",
"/d:sonar.login=\\"token\\"",
]
}
- isOneLine={true}
/>
<p
className="big-spacer-top markdown"
}
}
/>
- <Command
- command="plugins {
+ <CodeSnippet
+ snippet="plugins {
id \\"org.sonarqube\\" version \\"2.6\\"
}"
/>
>
onboarding.analysis.java.gradle.text.2
</p>
- <Command
- command={
+ <CodeSnippet
+ snippet={
Array [
"./gradlew sonarqube",
undefined,
}
}
/>
- <Command
- command="plugins {
+ <CodeSnippet
+ snippet="plugins {
id \\"org.sonarqube\\" version \\"2.6\\"
}"
/>
>
onboarding.analysis.java.gradle.text.2
</p>
- <Command
- command={
+ <CodeSnippet
+ snippet={
Array [
"./gradlew sonarqube",
"-Dsonar.organization=organization",
>
onboarding.analysis.java.maven.text
</p>
- <Command
- command={
+ <CodeSnippet
+ snippet={
Array [
"mvn sonar:sonar",
undefined,
>
onboarding.analysis.java.maven.text
</p>
- <Command
- command={
+ <CodeSnippet
+ snippet={
Array [
"mvn sonar:sonar",
"-Dsonar.organization=organization",
}
}
/>
- <Command
- command={
+ <CodeSnippet
+ isOneLine={true}
+ snippet={
Array [
"SonarQube.Scanner.MSBuild.exe begin",
"/k:\\"projectKey\\"",
"/d:sonar.login=\\"token\\"",
]
}
- isOneLine={true}
/>
- <Command
- command="build-wrapper-win-x86-64.exe --out-dir bw-output MsBuild.exe /t:Rebuild"
+ <CodeSnippet
isOneLine={true}
+ snippet="build-wrapper-win-x86-64.exe --out-dir bw-output MsBuild.exe /t:Rebuild"
/>
- <Command
- command={
+ <CodeSnippet
+ isOneLine={true}
+ snippet={
Array [
"SonarQube.Scanner.MSBuild.exe end",
"/d:sonar.login=\\"token\\"",
]
}
- isOneLine={true}
/>
<p
className="big-spacer-top markdown"
}
}
/>
- <Command
- command={
+ <CodeSnippet
+ isOneLine={true}
+ snippet={
Array [
"SonarQube.Scanner.MSBuild.exe begin",
"/k:\\"projectKey\\"",
"/d:sonar.login=\\"token\\"",
]
}
- isOneLine={true}
/>
- <Command
- command="build-wrapper-win-x86-64.exe --out-dir bw-output MsBuild.exe /t:Rebuild"
+ <CodeSnippet
isOneLine={true}
+ snippet="build-wrapper-win-x86-64.exe --out-dir bw-output MsBuild.exe /t:Rebuild"
/>
- <Command
- command={
+ <CodeSnippet
+ isOneLine={true}
+ snippet={
Array [
"SonarQube.Scanner.MSBuild.exe end",
"/d:sonar.login=\\"token\\"",
]
}
- isOneLine={true}
/>
<p
className="big-spacer-top markdown"
}
}
/>
- <Command
- command={
+ <CodeSnippet
+ isOneLine={true}
+ snippet={
Array [
"sonar-scanner.bat",
"-Dsonar.projectKey=projectKey",
"-Dsonar.login=token",
]
}
- isOneLine={true}
/>
<p
className="big-spacer-top markdown"
}
}
/>
- <Command
- command={
+ <CodeSnippet
+ isOneLine={false}
+ snippet={
Array [
"sonar-scanner",
"-Dsonar.projectKey=projectKey",
"-Dsonar.login=token",
]
}
- isOneLine={false}
/>
<p
className="big-spacer-top markdown"
}
}
/>
- <Command
- command={
+ <CodeSnippet
+ isOneLine={false}
+ snippet={
Array [
"sonar-scanner",
"-Dsonar.projectKey=projectKey",
"-Dsonar.login=token",
]
}
- isOneLine={false}
/>
<p
className="big-spacer-top markdown"
outline: none;
}
-.onboarding-command {
- position: relative;
- margin: 8px 0;
-}
-
-.onboarding-command pre {
- padding: 15px;
- border-radius: 2px;
- background: var(--gray40);
- color: var(--snippetFontColor);
- overflow: auto;
-}
-
-.onboarding-command button {
- position: absolute;
- top: 15px;
- right: 15px;
- height: 20px;
- line-height: 18px;
- border: 1px solid #fff;
- color: #fff;
- font-size: 11px;
- font-weight: normal;
- user-select: none;
-}
-
-.onboarding-command button:hover,
-.onboarding-command button:focus,
-.onboarding-command button:active {
- background-color: #fff;
- color: var(--gray40);
-}
-
-.onboarding-command-oneline pre {
- padding-bottom: 40px;
-}
-
-.onboarding-command-oneline button {
- top: auto;
- top: 40px;
-}
-
.onboarding .page-actions {
text-align: right;
margin-bottom: 0;
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2018 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.
+ */
+.code-snippet {
+ position: relative;
+ margin: var(--gridSize) 0;
+ background: var(--gray40);
+ color: var(--snippetFontColor);
+ border-radius: 3px;
+}
+
+.code-snippet pre {
+ padding: calc(2 * var(--gridSize));
+ overflow: auto;
+}
+
+.code-snippet button {
+ position: absolute;
+ top: calc(2 * var(--gridSize));
+ right: calc(2 * var(--gridSize));
+ line-height: 18px;
+ border: 1px solid #fff;
+ color: #fff;
+ font-size: 11px;
+ font-weight: normal;
+ user-select: none;
+}
+
+.code-snippet button:hover,
+.code-snippet button:focus,
+.code-snippet button:active {
+ background-color: #fff;
+ color: var(--gray40);
+}
+
+.code-snippet-oneline pre {
+ padding-bottom: 40px;
+}
+
+.code-snippet-oneline button {
+ top: auto;
+ top: 40px;
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2018 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 * as React from 'react';
+import * as classNames from 'classnames';
+import ClipboardButton from '../controls/ClipboardButton';
+import './CodeSnippet.css';
+
+interface Props {
+ className?: string;
+ isOneLine?: boolean;
+ noCopy?: boolean;
+ snippet: string | (string | undefined)[];
+}
+
+// keep this "useless" concatentation for the readability reason
+// eslint-disable-next-line no-useless-concat
+const s = ' \\' + '\n ';
+
+export default function CodeSnippet({ className, isOneLine, noCopy, snippet }: Props) {
+ const snippetArray = Array.isArray(snippet)
+ ? snippet.filter(line => line !== undefined)
+ : [snippet];
+ const finalSnippet = isOneLine ? snippetArray.join(' ') : snippetArray.join(s);
+ return (
+ <div className={classNames('code-snippet', { 'code-snippet-oneline': isOneLine }, className)}>
+ <pre>{finalSnippet}</pre>
+ {!noCopy && <ClipboardButton copyValue={finalSnippet} tooltipPlacement="top" />}
+ </div>
+ );
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2018 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 * as React from 'react';
+import { mount } from 'enzyme';
+import CodeSnippet from '../CodeSnippet';
+
+it('renders correctly', () => {
+ expect(mount(<CodeSnippet snippet={'foo\nbar'} />)).toMatchSnapshot();
+ expect(mount(<CodeSnippet snippet={'foo\nbar'} noCopy={true} />)).toMatchSnapshot();
+});
+
+it('renders correctly with array snippet', () => {
+ expect(mount(<CodeSnippet snippet={['foo', 'bar']} />)).toMatchSnapshot();
+ expect(mount(<CodeSnippet snippet={['foo', 'bar']} isOneLine={true} />)).toMatchSnapshot();
+});
--- /dev/null
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`renders correctly 1`] = `
+<CodeSnippet
+ snippet="foo
+bar"
+>
+ <div
+ className="code-snippet"
+ >
+ <pre>
+ foo
+bar
+ </pre>
+ <ClipboardButton
+ copyValue="foo
+bar"
+ tooltipPlacement="top"
+ >
+ <button
+ className="js-copy-to-clipboard no-select"
+ data-clipboard-text="foo
+bar"
+ >
+ copy
+ </button>
+ </ClipboardButton>
+ </div>
+</CodeSnippet>
+`;
+
+exports[`renders correctly 2`] = `
+<CodeSnippet
+ noCopy={true}
+ snippet="foo
+bar"
+>
+ <div
+ className="code-snippet"
+ >
+ <pre>
+ foo
+bar
+ </pre>
+ </div>
+</CodeSnippet>
+`;
+
+exports[`renders correctly with array snippet 1`] = `
+<CodeSnippet
+ snippet={
+ Array [
+ "foo",
+ "bar",
+ ]
+ }
+>
+ <div
+ className="code-snippet"
+ >
+ <pre>
+ foo \\
+ bar
+ </pre>
+ <ClipboardButton
+ copyValue="foo \\\\
+ bar"
+ tooltipPlacement="top"
+ >
+ <button
+ className="js-copy-to-clipboard no-select"
+ data-clipboard-text="foo \\\\
+ bar"
+ >
+ copy
+ </button>
+ </ClipboardButton>
+ </div>
+</CodeSnippet>
+`;
+
+exports[`renders correctly with array snippet 2`] = `
+<CodeSnippet
+ isOneLine={true}
+ snippet={
+ Array [
+ "foo",
+ "bar",
+ ]
+ }
+>
+ <div
+ className="code-snippet code-snippet-oneline"
+ >
+ <pre>
+ foo bar
+ </pre>
+ <ClipboardButton
+ copyValue="foo bar"
+ tooltipPlacement="top"
+ >
+ <button
+ className="js-copy-to-clipboard no-select"
+ data-clipboard-text="foo bar"
+ >
+ copy
+ </button>
+ </ClipboardButton>
+ </div>
+</CodeSnippet>
+`;