This repository has been archived by the owner on Jun 6, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.spec.ts
54 lines (40 loc) · 1.33 KB
/
index.spec.ts
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import { rclsx } from './index';
test('Undefined as the only argument', () => {
// @ts-ignore
const actual = rclsx(undefined);
const expected = '';
expect(actual).toBe(expected);
});
test('Just a base class', () => {
const actual = rclsx('base');
const expected = 'base';
expect(actual).toBe(expected);
});
test('Just a responsive object', () => {
const actual = rclsx({ sm: 'sm-class other-sm-class' });
const expected = 'sm:sm-class sm:other-sm-class';
expect(actual).toBe(expected);
});
test('Base class with one responsive object key', () => {
const actual = rclsx('base', { sm: 'sm-class other-sm-class' });
const expected = 'base sm:sm-class sm:other-sm-class';
expect(actual).toBe(expected);
});
test('Base class with several responsive object keys', () => {
const actual = rclsx('base', {
sm: 'sm-class other-sm-class',
md: 'md-class other-md-class',
});
const expected =
'base sm:sm-class sm:other-sm-class md:md-class md:other-md-class';
expect(actual).toBe(expected);
});
test('Whitespace craziness', () => {
const actual = rclsx(' base other-base ', {
sm: ' sm-class other-sm-class ',
md: 'md-class other-md-class ',
});
const expected =
'base other-base sm:sm-class sm:other-sm-class md:md-class md:other-md-class';
expect(actual).toBe(expected);
});