Skip to content

test: Add test for Color Helpers (#518) #565

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 25, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions __tests__/tests/utilities/color-helpers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { getFontColorByBackground } from 'utils';

describe('Color Helpers', () => {
it('should return a black font color for the light yellow background', () => {
const lightYellowColor = 'e5f496';
expect(getFontColorByBackground(lightYellowColor)).toBe('#000000');
});

it('should return a black font color for the light blue background', () => {
const lightBlueColor = 'a9b3ff';
expect(getFontColorByBackground(lightBlueColor)).toBe('#000000');
});

it('should return a black font color for the light red background', () => {
const lightRedColor = 'f4ad96';
expect(getFontColorByBackground(lightRedColor)).toBe('#000000');
});

it('should return a white font color for the dark green background', () => {
const darkGreenColor = '288702';
expect(getFontColorByBackground(darkGreenColor)).toBe('#ffffff');
});

it('should return a white font color for the dark blue background', () => {
const darkBlueColor = '0800fd';
expect(getFontColorByBackground(darkBlueColor)).toBe('#ffffff');
});

it('should return a white font color for the dark red background', () => {
const darkRedColor = 'fd0000';
expect(getFontColorByBackground(darkRedColor)).toBe('#ffffff');
});
});