| 1 | 'use strict';
|
|---|
| 2 |
|
|---|
| 3 | const parsers = require('./parsers');
|
|---|
| 4 |
|
|---|
| 5 | describe('valueType', () => {
|
|---|
| 6 | it('returns color for red', () => {
|
|---|
| 7 | let input = 'red';
|
|---|
| 8 | let output = parsers.valueType(input);
|
|---|
| 9 |
|
|---|
| 10 | expect(output).toEqual(parsers.TYPES.COLOR);
|
|---|
| 11 | });
|
|---|
| 12 |
|
|---|
| 13 | it('returns color for #nnnnnn', () => {
|
|---|
| 14 | let input = '#fefefe';
|
|---|
| 15 | let output = parsers.valueType(input);
|
|---|
| 16 |
|
|---|
| 17 | expect(output).toEqual(parsers.TYPES.COLOR);
|
|---|
| 18 | });
|
|---|
| 19 |
|
|---|
| 20 | it('returns color for rgb(n, n, n)', () => {
|
|---|
| 21 | let input = 'rgb(10, 10, 10)';
|
|---|
| 22 | let output = parsers.valueType(input);
|
|---|
| 23 |
|
|---|
| 24 | expect(output).toEqual(parsers.TYPES.COLOR);
|
|---|
| 25 | });
|
|---|
| 26 |
|
|---|
| 27 | it('returns color for rgb(p, p, p)', () => {
|
|---|
| 28 | let input = 'rgb(10%, 10%, 10%)';
|
|---|
| 29 | let output = parsers.valueType(input);
|
|---|
| 30 |
|
|---|
| 31 | expect(output).toEqual(parsers.TYPES.COLOR);
|
|---|
| 32 | });
|
|---|
| 33 |
|
|---|
| 34 | it('returns color for rgba(n, n, n, n)', () => {
|
|---|
| 35 | let input = 'rgba(10, 10, 10, 1)';
|
|---|
| 36 | let output = parsers.valueType(input);
|
|---|
| 37 |
|
|---|
| 38 | expect(output).toEqual(parsers.TYPES.COLOR);
|
|---|
| 39 | });
|
|---|
| 40 |
|
|---|
| 41 | it('returns color for rgba(n, n, n, n) with decimal alpha', () => {
|
|---|
| 42 | let input = 'rgba(10, 10, 10, 0.5)';
|
|---|
| 43 | let output = parsers.valueType(input);
|
|---|
| 44 |
|
|---|
| 45 | expect(output).toEqual(parsers.TYPES.COLOR);
|
|---|
| 46 | });
|
|---|
| 47 |
|
|---|
| 48 | it('returns color for rgba(p, p, p, n)', () => {
|
|---|
| 49 | let input = 'rgba(10%, 10%, 10%, 1)';
|
|---|
| 50 | let output = parsers.valueType(input);
|
|---|
| 51 |
|
|---|
| 52 | expect(output).toEqual(parsers.TYPES.COLOR);
|
|---|
| 53 | });
|
|---|
| 54 |
|
|---|
| 55 | it('returns color for rgba(p, p, p, n) with decimal alpha', () => {
|
|---|
| 56 | let input = 'rgba(10%, 10%, 10%, 0.5)';
|
|---|
| 57 | let output = parsers.valueType(input);
|
|---|
| 58 |
|
|---|
| 59 | expect(output).toEqual(parsers.TYPES.COLOR);
|
|---|
| 60 | });
|
|---|
| 61 |
|
|---|
| 62 | it('returns length for 100ch', () => {
|
|---|
| 63 | let input = '100ch';
|
|---|
| 64 | let output = parsers.valueType(input);
|
|---|
| 65 |
|
|---|
| 66 | expect(output).toEqual(parsers.TYPES.LENGTH);
|
|---|
| 67 | });
|
|---|
| 68 |
|
|---|
| 69 | it('returns calc from calc(100px * 2)', () => {
|
|---|
| 70 | let input = 'calc(100px * 2)';
|
|---|
| 71 | let output = parsers.valueType(input);
|
|---|
| 72 |
|
|---|
| 73 | expect(output).toEqual(parsers.TYPES.CALC);
|
|---|
| 74 | });
|
|---|
| 75 | });
|
|---|
| 76 | describe('parseInteger', () => {
|
|---|
| 77 | it.todo('test');
|
|---|
| 78 | });
|
|---|
| 79 | describe('parseNumber', () => {
|
|---|
| 80 | it.todo('test');
|
|---|
| 81 | });
|
|---|
| 82 | describe('parseLength', () => {
|
|---|
| 83 | it.todo('test');
|
|---|
| 84 | });
|
|---|
| 85 | describe('parsePercent', () => {
|
|---|
| 86 | it.todo('test');
|
|---|
| 87 | });
|
|---|
| 88 | describe('parseMeasurement', () => {
|
|---|
| 89 | it.todo('test');
|
|---|
| 90 | });
|
|---|
| 91 | describe('parseUrl', () => {
|
|---|
| 92 | it.todo('test');
|
|---|
| 93 | });
|
|---|
| 94 | describe('parseString', () => {
|
|---|
| 95 | it.todo('test');
|
|---|
| 96 | });
|
|---|
| 97 | describe('parseColor', () => {
|
|---|
| 98 | it('should convert hsl to rgb values', () => {
|
|---|
| 99 | let input = 'hsla(0, 1%, 2%)';
|
|---|
| 100 | let output = parsers.parseColor(input);
|
|---|
| 101 |
|
|---|
| 102 | expect(output).toEqual('rgb(5, 5, 5)');
|
|---|
| 103 | });
|
|---|
| 104 | it('should convert hsla to rgba values', () => {
|
|---|
| 105 | let input = 'hsla(0, 1%, 2%, 0.5)';
|
|---|
| 106 | let output = parsers.parseColor(input);
|
|---|
| 107 |
|
|---|
| 108 | expect(output).toEqual('rgba(5, 5, 5, 0.5)');
|
|---|
| 109 | });
|
|---|
| 110 |
|
|---|
| 111 | it.todo('Add more tests');
|
|---|
| 112 | });
|
|---|
| 113 | describe('parseAngle', () => {
|
|---|
| 114 | it.todo('test');
|
|---|
| 115 | });
|
|---|
| 116 | describe('parseKeyword', () => {
|
|---|
| 117 | it.todo('test');
|
|---|
| 118 | });
|
|---|
| 119 | describe('dashedToCamelCase', () => {
|
|---|
| 120 | it.todo('test');
|
|---|
| 121 | });
|
|---|
| 122 | describe('shorthandParser', () => {
|
|---|
| 123 | it.todo('test');
|
|---|
| 124 | });
|
|---|
| 125 | describe('shorthandSetter', () => {
|
|---|
| 126 | it.todo('test');
|
|---|
| 127 | });
|
|---|
| 128 | describe('shorthandGetter', () => {
|
|---|
| 129 | it.todo('test');
|
|---|
| 130 | });
|
|---|
| 131 | describe('implicitSetter', () => {
|
|---|
| 132 | it.todo('test');
|
|---|
| 133 | });
|
|---|
| 134 | describe('subImplicitSetter', () => {
|
|---|
| 135 | it.todo('test');
|
|---|
| 136 | });
|
|---|
| 137 | describe('camelToDashed', () => {
|
|---|
| 138 | it.todo('test');
|
|---|
| 139 | });
|
|---|