Skip to content

Commit

Permalink
RGBToHex -> rgbToHex
Browse files Browse the repository at this point in the history
  • Loading branch information
elias committed Feb 28, 2022
1 parent c723b1b commit ae6660d
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 57 deletions.
10 changes: 5 additions & 5 deletions src/components/BannerStrip/BannerStrip.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { composeStories } from '@storybook/testing-react';
import * as stories from './BannerStrip.stories';
import 'jest-styled-components';
import color from '../../styles/colors';
import RGBToHex from '../../utils/rgbToHex';
import rgbToHex from '../../utils/rgbToHex';

const { Standard, StandardWithButton, Warning, Error, Success } =
composeStories(stories);
Expand Down Expand Up @@ -42,7 +42,7 @@ describe('Banner Strip - Standard', () => {
);
const styles = element && getComputedStyle(element);
const bgColorHex =
styles && RGBToHex(styles.backgroundColor).toUpperCase();
styles && rgbToHex(styles.backgroundColor).toUpperCase();
expect(bgColorHex).toBe(color.blue);
});
});
Expand Down Expand Up @@ -93,7 +93,7 @@ describe('Banner Strip - Warning', () => {
);
const styles = element && getComputedStyle(element);
const bgColorHex =
styles && RGBToHex(styles.backgroundColor).toUpperCase();
styles && rgbToHex(styles.backgroundColor).toUpperCase();
expect(bgColorHex).toBe(color.yellow);
});
});
Expand All @@ -120,7 +120,7 @@ describe('Banner Strip - Error', () => {
);
const styles = element && getComputedStyle(element);
const bgColorHex =
styles && RGBToHex(styles.backgroundColor).toUpperCase();
styles && rgbToHex(styles.backgroundColor).toUpperCase();
expect(bgColorHex).toBe(color.red);
});
});
Expand All @@ -147,7 +147,7 @@ describe('Banner Strip - Success', () => {
);
const styles = element && getComputedStyle(element);
const bgColorHex =
styles && RGBToHex(styles.backgroundColor).toUpperCase();
styles && rgbToHex(styles.backgroundColor).toUpperCase();
expect(bgColorHex).toBe(color.green);
});
});
38 changes: 19 additions & 19 deletions src/components/Button/Button.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { fireEvent } from '@testing-library/react';
import { composeStories } from '@storybook/testing-react';
import * as stories from './Button.stories';
import color from '../../styles/colors';
import RGBToHex from '../../utils/rgbToHex';
import rgbToHex from '../../utils/rgbToHex';

const {
Primary,
Expand Down Expand Up @@ -59,9 +59,9 @@ describe('Button - Primary', () => {
);
const styles = element && getComputedStyle(element);
const bgColorHex =
styles && RGBToHex(styles.backgroundColor).toUpperCase();
styles && rgbToHex(styles.backgroundColor).toUpperCase();
expect(bgColorHex).toBe(color.green);
const colorHex = styles && RGBToHex(styles.color).toUpperCase();
const colorHex = styles && rgbToHex(styles.color).toUpperCase();
expect(colorHex).toBe(color.white);
});

Expand Down Expand Up @@ -90,10 +90,10 @@ describe('Button - Primary Large', () => {
`[data-testid="${buttonTestId}"]`,
);
const styles = element && getComputedStyle(element);
const colorHex = styles && RGBToHex(styles.color).toUpperCase();
const colorHex = styles && rgbToHex(styles.color).toUpperCase();
expect(colorHex).toBe(color.white);
const bgColorHex =
styles && RGBToHex(styles.backgroundColor).toUpperCase();
styles && rgbToHex(styles.backgroundColor).toUpperCase();
expect(bgColorHex).toBe(color.green);
expect(styles?.borderWidth).toBe('4px');
expect(styles?.fontSize).toBe('16px');
Expand All @@ -117,10 +117,10 @@ describe('Button - Primary Small', () => {
`[data-testid="${buttonTestId}"]`,
);
const styles = element && getComputedStyle(element);
const colorHex = styles && RGBToHex(styles.color).toUpperCase();
const colorHex = styles && rgbToHex(styles.color).toUpperCase();
expect(colorHex).toBe(color.white);
const bgColorHex =
styles && RGBToHex(styles.backgroundColor).toUpperCase();
styles && rgbToHex(styles.backgroundColor).toUpperCase();
expect(bgColorHex).toBe(color.green);
expect(styles?.fontSize).toBe('13px');
expect(styles?.padding).toBe('2px 12px');
Expand Down Expand Up @@ -275,9 +275,9 @@ describe('Button - Secondary', () => {
);
const styles = element && getComputedStyle(element);
const bgColorHex =
styles && RGBToHex(styles.backgroundColor).toUpperCase();
styles && rgbToHex(styles.backgroundColor).toUpperCase();
expect(bgColorHex).toBe(color.blueLight);
const colorHex = styles && RGBToHex(styles.color).toUpperCase();
const colorHex = styles && rgbToHex(styles.color).toUpperCase();
expect(colorHex).toBe(color.blue);
});

Expand Down Expand Up @@ -321,9 +321,9 @@ describe('Button - Outline', () => {
);
const styles = element && getComputedStyle(element);
const bgColorHex =
styles && RGBToHex(styles.backgroundColor).toUpperCase();
styles && rgbToHex(styles.backgroundColor).toUpperCase();
expect(bgColorHex).toBe(color.white);
const colorHex = styles && RGBToHex(styles.color).toUpperCase();
const colorHex = styles && rgbToHex(styles.color).toUpperCase();
expect(colorHex).toBe(color.blue);
});
it('returns the normal onClick event', () => {
Expand Down Expand Up @@ -366,9 +366,9 @@ describe('Button - ColoredRed', () => {
);
const styles = element && getComputedStyle(element);
const bgColorHex =
styles && RGBToHex(styles.backgroundColor).toUpperCase();
styles && rgbToHex(styles.backgroundColor).toUpperCase();
expect(bgColorHex).toBe(color.red);
const colorHex = styles && RGBToHex(styles.color).toUpperCase();
const colorHex = styles && rgbToHex(styles.color).toUpperCase();
expect(colorHex).toBe(color.red);
});
it('returns the normal onClick event', () => {
Expand Down Expand Up @@ -411,9 +411,9 @@ describe('Button - ColoredBlue', () => {
);
const styles = element && getComputedStyle(element);
const bgColorHex =
styles && RGBToHex(styles.backgroundColor).toUpperCase();
styles && rgbToHex(styles.backgroundColor).toUpperCase();
expect(bgColorHex).toBe(color.blue);
const colorHex = styles && RGBToHex(styles.color).toUpperCase();
const colorHex = styles && rgbToHex(styles.color).toUpperCase();
expect(colorHex).toBe(color.blue);
});
it('returns the normal onClick event', () => {
Expand Down Expand Up @@ -456,9 +456,9 @@ describe('Button - ColoredGreen', () => {
);
const styles = element && getComputedStyle(element);
const bgColorHex =
styles && RGBToHex(styles.backgroundColor).toUpperCase();
styles && rgbToHex(styles.backgroundColor).toUpperCase();
expect(bgColorHex).toBe(color.green);
const colorHex = styles && RGBToHex(styles.color).toUpperCase();
const colorHex = styles && rgbToHex(styles.color).toUpperCase();
expect(colorHex).toBe(color.green);
});
it('returns the normal onClick event', () => {
Expand Down Expand Up @@ -501,9 +501,9 @@ describe('Button - ColoredYellow', () => {
);
const styles = element && getComputedStyle(element);
const bgColorHex =
styles && RGBToHex(styles.backgroundColor).toUpperCase();
styles && rgbToHex(styles.backgroundColor).toUpperCase();
expect(bgColorHex).toBe(color.yellow);
const colorHex = styles && RGBToHex(styles.color).toUpperCase();
const colorHex = styles && rgbToHex(styles.color).toUpperCase();
expect(colorHex).toBe(color.yellow);
});
it('returns the normal onClick event', () => {
Expand Down
3 changes: 1 addition & 2 deletions src/components/CreditCard/CreditCard.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ export const DivStyledFlex = styled.div`
export const DivStyledFlexText = styled.div`
color: white;
display: flex;
gap: 15px;
`;

export const DivStyledRemove = styled.div`
Expand All @@ -73,7 +72,7 @@ export const PStyledText = styled.p`
color: ${colors.white};
font-size: 12px;
line-height: 16px;
margin: 0;
margin: 0 0 0 5px;
`;

const expiredStyles = css`
Expand Down
14 changes: 7 additions & 7 deletions src/components/CryptoCards/CryptoCards.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React from 'react';
import { fireEvent, screen } from '@testing-library/react';
import { composeStories } from '@storybook/testing-react';
import * as stories from './CryptoCards.stories';
import RGBToHex from '../../utils/rgbToHex';
import rgbToHex from '../../utils/rgbToHex';
import color from '../../styles/colors';
import 'jest-styled-components';
import '@testing-library/jest-dom/extend-expect';
Expand Down Expand Up @@ -51,7 +51,7 @@ describe('Ethereum', () => {
);
const styles = element && getComputedStyle(element);
const bgColorHex =
styles && RGBToHex(styles.backgroundColor).toUpperCase();
styles && rgbToHex(styles.backgroundColor).toUpperCase();
expect(bgColorHex).toBe(color.black);
});

Expand Down Expand Up @@ -106,7 +106,7 @@ describe('Binance', () => {
);
const styles = element && getComputedStyle(element);
const bgColorHex =
styles && RGBToHex(styles.backgroundColor).toUpperCase();
styles && rgbToHex(styles.backgroundColor).toUpperCase();
expect(bgColorHex).toBe(color.black);
});

Expand Down Expand Up @@ -161,7 +161,7 @@ describe('Polygon', () => {
);
const styles = element && getComputedStyle(element);
const bgColorHex =
styles && RGBToHex(styles.backgroundColor).toUpperCase();
styles && rgbToHex(styles.backgroundColor).toUpperCase();
expect(bgColorHex).toBe(color.black);
});

Expand Down Expand Up @@ -216,7 +216,7 @@ describe('Avalanche', () => {
);
const styles = element && getComputedStyle(element);
const bgColorHex =
styles && RGBToHex(styles.backgroundColor).toUpperCase();
styles && rgbToHex(styles.backgroundColor).toUpperCase();
expect(bgColorHex).toBe(color.black);
});

Expand Down Expand Up @@ -271,7 +271,7 @@ describe('Fantom', () => {
);
const styles = element && getComputedStyle(element);
const bgColorHex =
styles && RGBToHex(styles.backgroundColor).toUpperCase();
styles && rgbToHex(styles.backgroundColor).toUpperCase();
expect(bgColorHex).toBe(color.black);
});

Expand Down Expand Up @@ -326,7 +326,7 @@ describe('Arbitrum', () => {
);
const styles = element && getComputedStyle(element);
const bgColorHex =
styles && RGBToHex(styles.backgroundColor).toUpperCase();
styles && rgbToHex(styles.backgroundColor).toUpperCase();
expect(bgColorHex).toBe(color.black);
});

Expand Down
16 changes: 8 additions & 8 deletions src/components/Input/Input.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { composeStories } from '@storybook/testing-react';
import * as stories from './Input.stories';
import color from '../../styles/colors';
import React from 'react';
import RGBToHex from '../../utils/rgbToHex';
import rgbToHex from '../../utils/rgbToHex';

const {
EmailInput,
Expand Down Expand Up @@ -89,7 +89,7 @@ describe('Input - Text', () => {
`[data-testid="${testDivId}"]`,
);
const styles = input && getComputedStyle(input);
expect(RGBToHex(styles?.outlineColor).toUpperCase()).toBe(
expect(rgbToHex(styles?.outlineColor).toUpperCase()).toBe(
color.greyLight,
);
});
Expand Down Expand Up @@ -190,7 +190,7 @@ describe('Input - Text Error', () => {
`[data-testid="${testDivId}"]`,
);
const styles = input && getComputedStyle(input);
expect(RGBToHex(styles?.outlineColor).toUpperCase()).toBe(color.red);
expect(rgbToHex(styles?.outlineColor).toUpperCase()).toBe(color.red);
});

it('renders label text', () => {
Expand Down Expand Up @@ -289,7 +289,7 @@ describe('Input - Text Confirmed', () => {
`[data-testid="${testDivId}"]`,
);
const styles = input && getComputedStyle(input);
expect(RGBToHex(styles?.outlineColor).toUpperCase()).toBe(color.green);
expect(rgbToHex(styles?.outlineColor).toUpperCase()).toBe(color.green);
});

it('renders label text', () => {
Expand Down Expand Up @@ -389,7 +389,7 @@ describe('Input - Number', () => {
`[data-testid="${testDivId}"]`,
);
const styles = input && getComputedStyle(input);
expect(RGBToHex(styles?.outlineColor).toUpperCase()).toBe(
expect(rgbToHex(styles?.outlineColor).toUpperCase()).toBe(
color.greyLight,
);
});
Expand Down Expand Up @@ -501,7 +501,7 @@ describe('Input - Password', () => {
`[data-testid="${testDivId}"]`,
);
const styles = input && getComputedStyle(input);
expect(RGBToHex(styles?.outlineColor).toUpperCase()).toBe(
expect(rgbToHex(styles?.outlineColor).toUpperCase()).toBe(
color.greyLight,
);
});
Expand Down Expand Up @@ -603,7 +603,7 @@ describe('Input - Email', () => {
`[data-testid="${testDivId}"]`,
);
const styles = input && getComputedStyle(input);
expect(RGBToHex(styles?.outlineColor).toUpperCase()).toBe(
expect(rgbToHex(styles?.outlineColor).toUpperCase()).toBe(
color.greyLight,
);
});
Expand Down Expand Up @@ -705,7 +705,7 @@ describe('Input - Tel', () => {
`[data-testid="${testDivId}"]`,
);
const styles = input && getComputedStyle(input);
expect(RGBToHex(styles?.outlineColor).toUpperCase()).toBe(
expect(rgbToHex(styles?.outlineColor).toUpperCase()).toBe(
color.greyLight,
);
});
Expand Down
14 changes: 7 additions & 7 deletions src/components/LinkTo/LinkTo.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { composeStories } from '@storybook/testing-react';
import * as stories from './LinkTo.stories';
import 'jest-styled-components';
import color from '../../styles/colors';
import RGBToHex from '../../utils/rgbToHex';
import rgbToHex from '../../utils/rgbToHex';

const {
ExternalLink,
Expand Down Expand Up @@ -66,7 +66,7 @@ describe('LinkTo - External', () => {
`[data-testid="${testId}"]`,
);
const styles = element && getComputedStyle(element);
const colorHex = styles && RGBToHex(styles.color).toUpperCase();
const colorHex = styles && rgbToHex(styles.color).toUpperCase();
expect(colorHex).toBe(color.blue);
});

Expand Down Expand Up @@ -133,15 +133,15 @@ describe('LinkTo - External Icon After', () => {
`[data-testid="${testId}"]`,
);
const styles = element && getComputedStyle(element);
const colorHex = styles && RGBToHex(styles.color).toUpperCase();
const colorHex = styles && rgbToHex(styles.color).toUpperCase();
expect(colorHex).toBe(color.blue);
});
it('renders correct color for link', () => {
const element: HTMLAnchorElement | null = container.querySelector(
`[data-testid="${testId}"]`,
);
const styles = element && getComputedStyle(element);
const colorHex = styles && RGBToHex(styles.color).toUpperCase();
const colorHex = styles && rgbToHex(styles.color).toUpperCase();
expect(colorHex).toBe(color.blue);
});
it('renders inline so it can be mid text', () => {
Expand Down Expand Up @@ -206,7 +206,7 @@ describe('LinkTo - Email', () => {
`[data-testid="${testId}"]`,
);
const styles = element && getComputedStyle(element);
const colorHex = styles && RGBToHex(styles.color).toUpperCase();
const colorHex = styles && rgbToHex(styles.color).toUpperCase();
expect(colorHex).toBe(color.blue);
});
it('renders inline so it can be mid text', () => {
Expand Down Expand Up @@ -272,7 +272,7 @@ describe('LinkTo - External Icon After', () => {
`[data-testid="${testId}"]`,
);
const styles = element && getComputedStyle(element);
const colorHex = styles && RGBToHex(styles.color).toUpperCase();
const colorHex = styles && rgbToHex(styles.color).toUpperCase();
expect(colorHex).toBe(color.blue);
});
it('renders inline so it can be mid text', () => {
Expand Down Expand Up @@ -337,7 +337,7 @@ describe('LinkTo - No text set for link', () => {
`[data-testid="${testId}"]`,
);
const styles = element && getComputedStyle(element);
const colorHex = styles && RGBToHex(styles.color).toUpperCase();
const colorHex = styles && rgbToHex(styles.color).toUpperCase();
expect(colorHex).toBe(color.blue);
});
it('renders inline so it can be mid text', () => {
Expand Down
Loading

0 comments on commit ae6660d

Please sign in to comment.