UNPKG

2.22 kBPlain TextView Raw
1import * as csx from '../src/border';
2import * as assert from 'assert';
3
4describe('border()', () => {
5 it('handles color', () => {
6 const value = csx.border({ color: 'red' });
7 assert.equal(value, 'red');
8 })
9 it('handles style', () => {
10 const value = csx.border({ style: 'medium' });
11 assert.equal(value, 'medium');
12 })
13 it('handles width', () => {
14 const value = csx.border({ width: 2 });
15 assert.equal(value, '2px');
16 })
17 it('handles width as %', () => {
18 const value = csx.border({ width: '2%' });
19 assert.equal(value, '2%');
20 })
21 it('handles color + style + width', () => {
22 const value = csx.border({
23 color: 'red',
24 style: 'medium',
25 width: 2
26 });
27 assert.equal(value, 'red medium 2px');
28 })
29});
30describe('borderColor()', () => {
31 it('handles all sides', () => {
32 const value = csx.borderColor('red');
33 assert.equal(value, 'red');
34 })
35 it('handles topbottom rightleft', () => {
36 const value = csx.borderColor('red', 'blue');
37 assert.equal(value, 'red blue');
38 })
39 it('handles top rightleft bottom', () => {
40 const value = csx.borderColor('red', 'blue', 'green');
41 assert.equal(value, 'red blue green');
42 })
43 it('handles top right left bottom', () => {
44 const value = csx.borderColor('red', 'blue', 'green', 'orange');
45 assert.equal(value, 'red blue green orange');
46 })
47});
48describe('borderWidth()', () => {
49 it('handles all sides', () => {
50 const value = csx.borderWidth(1);
51 assert.equal(value, '1px');
52 })
53 it('handles topbottom rightleft', () => {
54 const value = csx.borderWidth(1, 2);
55 assert.equal(value, '1px 2px');
56 })
57 it('handles top rightleft bottom', () => {
58 const value = csx.borderWidth(1, 2, '3%');
59 assert.equal(value, '1px 2px 3%');
60 })
61 it('handles top right left bottom', () => {
62 const value = csx.borderWidth(1, 2, 3, 4);
63 assert.equal(value, '1px 2px 3px 4px');
64 });
65});
66describe('borderStyle()', () => {
67 it('handles all sides', () => {
68 const value = csx.borderWidth('solid');
69 assert.equal(value, 'solid');
70 })
71 it('handles topbottom rightleft', () => {
72 const value = csx.borderWidth('solid', 'solid');
73 assert.equal(value, 'solid solid');
74 })
75});