-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
37 lines (30 loc) · 1003 Bytes
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/* eslint-env mocha */
'use strict'
const cr = require('./index')
const assert = require('chai').assert
describe('Color regular expressions', () => {
it('should be valid hex', () => {
assert(cr.hex.strict.test('#fff'))
assert(cr.hex.strict.test('#000000'))
})
it('should be a vaild hexa', () => {
assert(cr.hexa.strict.test('#56ff0077'))
})
it('should be a valid rgb', () => {
assert(cr.rgb.strict.test('rgb(0,0,0)'))
assert(cr.rgb.strict.test('rgb(0, 0, 0)'))
})
it('should be a valid rgba', () => {
assert(cr.rgba.strict.test('rgba(0,0,0, 1.0)'))
assert(cr.rgba.strict.test('rgba(0,0,0, 0.6)'))
assert(cr.rgba.strict.test('rgba(255,255,255, .9)'))
})
it('should be a valid hsl', () => {
assert(cr.hsl.strict.test('hsl(0, 0%, 1%)'))
assert(cr.hsl.strict.test('hsl(0,5%,1%)'))
})
it('should be a valid hsla', () => {
assert(cr.hsla.strict.test('hsla(0, 0%, 1%, .9)'))
assert(cr.hsla.strict.test('hsla(0,5%,1%, 1.0)'))
})
})