Skip to content
This repository was archived by the owner on Jan 16, 2022. It is now read-only.

Commit 7d41dab

Browse files
ref(components): Remove CopyToClipBoard Jest Snapshot & Create new un… (#605)
1 parent 5ba5aa0 commit 7d41dab

File tree

13 files changed

+106
-265
lines changed

13 files changed

+106
-265
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@
201201
"test:clean": "jest --clearCache",
202202
"test:acceptance": "codeceptjs run --steps",
203203
"test:acceptance:server": "concurrently --kill-others \"yarn run verdaccio:server\" \"yarn run test:acceptance\"",
204-
"test:e2e": " jest --config ./test/jest.config.e2e.js",
204+
"test:e2e": " jest --config ./test/jest.config.e2e.js --runInBand",
205205
"test": "BABEL_ENV=test NODE_ENV=test TZ=UTC jest --config ./jest/jest.config.js --maxWorkers 2 --passWithNoTests",
206206
"test:update-snapshot": "yarn run test -- -u",
207207
"test:size": "bundlesize",

src/App/Header/RegistryInfoContent/RegistryInfoContent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ const RegistryInfoContent: React.FC<Props> = props => {
6767
/* eslint react/prop-types:0 */
6868
const TabContainer: React.FC = ({ children }): JSX.Element => {
6969
return (
70-
<CommandContainer>
70+
<CommandContainer data-testid={'tab-content'}>
7171
<Typography>{children}</Typography>
7272
</CommandContainer>
7373
);

src/components/CopyToClipBoard.tsx

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import styled from '@emotion/styled';
2+
import FileCopy from '@material-ui/icons/FileCopy';
3+
import React from 'react';
4+
import { useTranslation } from 'react-i18next';
5+
6+
import { copyToClipBoardUtility } from 'verdaccio-ui/utils/cli-utils';
7+
8+
import IconButton from './IconButton';
9+
import Tooltip from './Tooltip';
10+
11+
interface Props {
12+
text: string;
13+
children?: React.ReactNode;
14+
}
15+
16+
function CopyToClipBoard({ text, children, ...props }: Props) {
17+
const { t } = useTranslation();
18+
return (
19+
<Wrapper {...props}>
20+
<Content>{children ?? text}</Content>
21+
<Tooltip disableFocusListener={true} title={t('copy-to-clipboard')}>
22+
<IconButton onClick={copyToClipBoardUtility(text)} data-testid="copy-icon">
23+
<FileCopy />
24+
</IconButton>
25+
</Tooltip>
26+
</Wrapper>
27+
);
28+
}
29+
30+
export default CopyToClipBoard;
31+
32+
const Wrapper = styled('div')({
33+
display: 'flex',
34+
alignItems: 'center',
35+
justifyContent: 'space-between',
36+
});
37+
38+
const Content = styled('span')({
39+
display: 'inline-block',
40+
overflow: 'hidden',
41+
whiteSpace: 'nowrap',
42+
textOverflow: 'ellipsis',
43+
height: '21px',
44+
fontSize: '1rem',
45+
});

src/components/CopyToClipBoard/CopyToClipBoard.tsx

Lines changed: 0 additions & 38 deletions
This file was deleted.

src/components/CopyToClipBoard/__snapshots__/CopyToClipBoard.test.tsx.snap

Lines changed: 0 additions & 180 deletions
This file was deleted.

src/components/CopyToClipBoard/index.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/components/CopyToClipBoard/styles.ts

Lines changed: 0 additions & 20 deletions
This file was deleted.

src/pages/Version/DetailSidebar/Install/__snapshots__/Install.test.tsx.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ exports[`<Install /> renders correctly 1`] = `
4545
4646
.emotion-10 {
4747
display: inline-block;
48-
text-overflow: ellipsis;
4948
overflow: hidden;
5049
white-space: nowrap;
50+
text-overflow: ellipsis;
5151
height: 21px;
5252
font-size: 1rem;
5353
}
@@ -92,7 +92,7 @@ exports[`<Install /> renders correctly 1`] = `
9292
npm install foo
9393
</span>
9494
<button
95-
class="MuiButtonBase-root MuiIconButton-root emotion-12 emotion-13"
95+
class="MuiButtonBase-root MuiIconButton-root"
9696
data-testid="copy-icon"
9797
tabindex="0"
9898
title="Copy to clipboard"
@@ -159,7 +159,7 @@ exports[`<Install /> renders correctly 1`] = `
159159
yarn add foo
160160
</span>
161161
<button
162-
class="MuiButtonBase-root MuiIconButton-root emotion-12 emotion-13"
162+
class="MuiButtonBase-root MuiIconButton-root"
163163
data-testid="copy-icon"
164164
tabindex="0"
165165
title="Copy to clipboard"
@@ -226,7 +226,7 @@ exports[`<Install /> renders correctly 1`] = `
226226
pnpm install foo
227227
</span>
228228
<button
229-
class="MuiButtonBase-root MuiIconButton-root emotion-12 emotion-13"
229+
class="MuiButtonBase-root MuiIconButton-root"
230230
data-testid="copy-icon"
231231
tabindex="0"
232232
title="Copy to clipboard"

src/pages/home/PackageList/Help/__snapshots__/Help.test.tsx.snap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ exports[`<Help /> component should load the component in default state 1`] = `
2727
2828
.emotion-6 {
2929
display: inline-block;
30-
text-overflow: ellipsis;
3130
overflow: hidden;
3231
white-space: nowrap;
32+
text-overflow: ellipsis;
3333
height: 21px;
3434
font-size: 1rem;
3535
}
@@ -66,7 +66,7 @@ exports[`<Help /> component should load the component in default state 1`] = `
6666
npm adduser --registry http://localhost
6767
</span>
6868
<button
69-
class="MuiButtonBase-root MuiIconButton-root emotion-8 emotion-9"
69+
class="MuiButtonBase-root MuiIconButton-root"
7070
data-testid="copy-icon"
7171
tabindex="0"
7272
title="Copy to clipboard"
@@ -105,7 +105,7 @@ exports[`<Help /> component should load the component in default state 1`] = `
105105
npm publish --registry http://localhost
106106
</span>
107107
<button
108-
class="MuiButtonBase-root MuiIconButton-root emotion-8 emotion-9"
108+
class="MuiButtonBase-root MuiIconButton-root"
109109
data-testid="copy-icon"
110110
tabindex="0"
111111
title="Copy to clipboard"

test/e2e/puppeteer_environment.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ class PuppeteerEnvironment extends NodeEnvironment {
2929
const config1 = new VerdaccioConfig(
3030
path.join(__dirname, './store-e2e'),
3131
path.join(__dirname, './config/config-scoped-e2e.yaml'),
32-
'http://0.0.0.0:55558/',
32+
'http://localhost:55558/',
3333
55558
3434
);
3535
const config2 = new VerdaccioConfig(
3636
path.join(__dirname, './store-e2e'),
3737
path.join(__dirname, './config/config-protected-e2e.yaml'),
38-
'http://0.0.0.0:55552/',
38+
'http://localhost:55552/',
3939
55552
4040
);
4141
const server1 = new Server.default(config1.domainPath);

0 commit comments

Comments
 (0)