Skip to content

Commit

Permalink
fix: use normal spaces as padding instead of nbsp
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Nov 13, 2019
1 parent aa29f45 commit 6a33c81
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
"@jest/reporters": "^25.0.0",
"@jest/test-result": "^25.0.0",
"@jest/types": "^25.0.0",
"chalk": "^2.4.2",
"ink": "^2.5.0",
"jest-util": "^25.0.0",
"react": "^16.11.0",
Expand Down
24 changes: 14 additions & 10 deletions src/shared.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,36 @@ import * as React from 'react';
import { Box, Color, ColorProps } from 'ink';
import { TestResult } from '@jest/test-result';
import { Config } from '@jest/types';
import chalk from 'chalk';
import slash from 'slash';
import { relativePath } from './utils';

export const Arrow: React.FC = () => <>{' \u203A '}</>;
export const Dot: React.FC = () => <>{' \u2022 '}</>;
export const DownArrow: React.FC = () => <>{' \u21B3 '}</>;

const pad = (string: string) => (chalk.supportsColor ? ` ${string} ` : string);

const PaddedColor: React.FC<ColorProps> = ({ children, ...props }) => (
<Box paddingRight={1}>
<Color {...props}>
&nbsp;
{children}
&nbsp;
</Color>
<Color {...props}>{children}</Color>
</Box>
);

const Status: React.FC<ColorProps> = props => (
<PaddedColor inverse bold {...props} />
const Status: React.FC<ColorProps & { text: string }> = ({
text,
...props
}) => (
<PaddedColor inverse bold {...props}>
{pad(text)}
</PaddedColor>
);

const Fails: React.FC = () => <Status red>FAIL</Status>;
const Fails: React.FC = () => <Status red text="FAIL" />;

const Pass: React.FC = () => <Status green>PASS</Status>;
const Pass: React.FC = () => <Status green text="PASS" />;

export const Runs: React.FC = () => <Status yellow>RUNS</Status>;
export const Runs: React.FC = () => <Status yellow text="RUNS" />;

export const DisplayName: React.FC<{
config: Config.ProjectConfig;
Expand Down

0 comments on commit 6a33c81

Please sign in to comment.