apphouse
Version:
Component library for React that uses observable state management and theme-able components.
24 lines (18 loc) • 607 B
text/typescript
import { isHexColor } from './isHexColor';
describe('isHexColor', () => {
test('valid hex color with hashtag', () => {
expect(isHexColor('#FF0000')).toBe(true);
});
test('valid hex color without hashtag', () => {
expect(isHexColor('FF0000')).toBe(false);
});
test('valid hex color with 3 characters', () => {
expect(isHexColor('#F00')).toBe(true);
});
test('valid hex color with lowercase characters', () => {
expect(isHexColor('#123abc')).toBe(true);
});
test('invalid hex color with special characters', () => {
expect(isHexColor('#12G')).toBe(false);
});
});