UNPKG

4.89 kBPlain TextView Raw
1import * as csx from '../src/index';
2import * as assert from 'assert';
3
4describe('transform()', () => {
5 it('transform takes no arguments and returns none', () => {
6 const value = csx.transform();
7 assert.equal(value, 'none');
8 })
9 it('transform takes one argument and returns it as a string', () => {
10 const value = csx.transform(csx.scale(1));
11 assert.equal(value, 'scale(1)');
12 })
13 it('transform takes more than one argument and delimits it by a space', () => {
14 const value = csx.transform(
15 csx.translateX('20deg'),
16 csx.rotate('0.5rem')
17 );
18 assert.equal(value, 'translateX(20deg) rotate(0.5rem)');
19 })
20});
21describe('matrix()', () => {
22 it('matrix is output to string', () => {
23 const value = csx.matrix(0, 1, 2, 3, 4, 5);
24 assert.equal(value, 'matrix(0, 1, 2, 3, 4, 5)');
25 })
26});
27describe('matrix3d()', () => {
28 it('matrix3d is output to string', () => {
29 const value = csx.matrix3d(0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5);
30 assert.equal(value, 'matrix3d(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5)');
31 })
32});
33describe('perspective()', () => {
34 it('perspective is output to string', () => {
35 const value = csx.perspective(`200px`);
36 assert.equal(value, 'perspective(200px)');
37 })
38});
39describe('rotate()', () => {
40 it('rotate is output to string', () => {
41 const value = csx.rotate('20deg');
42 assert.equal(value, 'rotate(20deg)');
43 })
44});
45describe('rotate3d()', () => {
46 it('rotate3d is output to string', () => {
47 const value = csx.rotate3d(0, 0, '0.5turn');
48 assert.equal(value, 'rotate3d(0, 0, 0.5turn)');
49 })
50});
51describe('rotateX()', () => {
52 it('rotateX is output to string', () => {
53 const value = csx.rotateX('1turn');
54 assert.equal(value, 'rotateX(1turn)');
55 })
56});
57describe('rotateY()', () => {
58 it('rotateY is output to string', () => {
59 const value = csx.rotateY('45rad');
60 assert.equal(value, 'rotateY(45rad)');
61 })
62});
63describe('rotateZ()', () => {
64 it('rotateZ is output to string', () => {
65 const value = csx.rotateZ('90deg');
66 assert.equal(value, 'rotateZ(90deg)');
67 })
68});
69describe('scale()', () => {
70 it('scale(x) is output to string', () => {
71 const value = csx.scale(1);
72 assert.equal(value, 'scale(1)');
73 })
74
75 it('scale(x,y) is output to string', () => {
76 const value = csx.scale(1, 2);
77 assert.equal(value, 'scale(1, 2)');
78 })
79});
80describe('scale3d()', () => {
81 it('scale3d is output to string', () => {
82 const value = csx.scale3d(0, 0, 2);
83 assert.equal(value, 'scale3d(0, 0, 2)');
84 })
85});
86describe('scaleX()', () => {
87 it('scaleX is output to string', () => {
88 const value = csx.scaleX(1.1);
89 assert.equal(value, 'scaleX(1.1)');
90 })
91});
92describe('scaleY()', () => {
93 it('scaleY is output to string', () => {
94 const value = csx.scaleY(1.1);
95 assert.equal(value, 'scaleY(1.1)');
96 })
97});
98describe('scaleZ()', () => {
99 it('scaleZ is output to string', () => {
100 const value = csx.scaleZ(1.1);
101 assert.equal(value, 'scaleZ(1.1)');
102 })
103});
104describe('skew()', () => {
105 it('skew is output to string', () => {
106 const value = csx.skew('0.5turn');
107 assert.equal(value, 'skew(0.5turn)');
108 })
109});
110describe('skewX()', () => {
111 it('skewX is output to string', () => {
112 const value = csx.skewX('0.5turn');
113 assert.equal(value, 'skewX(0.5turn)');
114 })
115});
116describe('skewY()', () => {
117 it('skewY is output to string', () => {
118 const value = csx.skewY('0.5turn');
119 assert.equal(value, 'skewY(0.5turn)');
120 })
121});
122describe('translate()', () => {
123 it('translate(xy) is output to string', () => {
124 const value = csx.translate('20px');
125 assert.equal(value, 'translate(20px)');
126 })
127 it('translate(x,y) is output to string', () => {
128 const value = csx.translate('20px', '30px');
129 assert.equal(value, 'translate(20px, 30px)');
130 })
131});
132describe('translate3d()', () => {
133 it('translate3d is output to string', () => {
134 const value = csx.translate3d(0, 0, '20em');
135 assert.equal(value, 'translate3d(0, 0, 20em)');
136 })
137});
138describe('translateX()', () => {
139 it('translateX is output to string', () => {
140 const value = csx.translateX('1rem');
141 assert.equal(value, 'translateX(1rem)');
142 })
143});
144describe('translateY()', () => {
145 it('translateY is output to string', () => {
146 const value = csx.translateY('1rem');
147 assert.equal(value, 'translateY(1rem)');
148 })
149});
150describe('translateZ()', () => {
151 it('translateZ is output to string', () => {
152 const value = csx.translateZ('1rem');
153 assert.equal(value, 'translateZ(1rem)');
154 })
155});
\No newline at end of file