UNPKG

apphouse

Version:

Component library for React that uses observable state management and theme-able components.

24 lines (18 loc) 656 B
import { isRgbaColor } from './isRgbaColor'; describe('isRgbaColor', () => { test('valid RGBA color', () => { expect(isRgbaColor('rgba(255, 0, 0, 0.5)')).toBe(true); }); test('invalid RGBA color with value out of range', () => { expect(isRgbaColor('rgba(0, 256, 0, 1)')).toBe(false); }); test('invalid RGB color', () => { expect(isRgbaColor('rgb(255, 0, 0)')).toBe(false); }); test('invalid RGBA color without alpha', () => { expect(isRgbaColor('rgba(255, 0, 0)')).toBe(false); }); test('invalid RGBA color with extra argument', () => { expect(isRgbaColor('rgba(255, 0, 0, 0.5, invalid)')).toBe(false); }); });