-
Notifications
You must be signed in to change notification settings - Fork 6
/
test.js
81 lines (68 loc) · 1.93 KB
/
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import test from 'ava';
import sinon from 'sinon';
const proxy = require('proxyquire').noCallThru();
// Lib
// ---------------
// Proxy everything that requires a CSS file
const screenSpy = sinon.stub();
const printSpy = sinon.stub();
const createTheme = proxy('./lib', {
'normalize.css': {},
'./index.css': {},
'./screen': screenSpy,
'spectacle/lib/themes/default/print': printSpy
}).default;
test('should be a factory', t => {
t.is(typeof createTheme, 'function');
});
test('should return screen/print styles', t => {
const style = createTheme();
t.true(style.hasOwnProperty('screen'));
t.true(style.hasOwnProperty('print'));
});
test('should init screen', t => {
createTheme('name', 'custom');
t.deepEqual(screenSpy.lastCall.args, ['name', 'custom']);
});
test('shoud inherit print', t => {
createTheme();
t.true(printSpy.called);
});
// Screen
// ---------------
// Proxy everything that requires a CSS file
const screen = proxy('./lib/screen', {
'./font.css': {}
}).default;
test('should be a factory', t => {
t.is(typeof screen, 'function');
});
test('should return an object', t => {
t.is(typeof screen(), 'object');
});
test('should be possible to overwrite with custom styles', t => {
const style = screen(null, {global:{body:{color: 'hotpink'}}});
t.is(style.global.body.color, 'hotpink');
});
test('should deep assign custom styles', t => {
const style = screen(null, {global:{body:{color: 'hotpink'}}});
t.truthy(style.global.body.background);
});
test('should expose nova colors', t => {
const { colors } = screen();
t.truthy(colors.cyan);
t.truthy(colors.blue);
t.truthy(colors.purple);
t.truthy(colors.pink);
t.truthy(colors.red);
t.truthy(colors.orange);
t.truthy(colors.yellow);
t.truthy(colors.green);
t.truthy(colors.gray0);
t.truthy(colors.gray1);
t.truthy(colors.gray2);
t.truthy(colors.gray3);
t.truthy(colors.gray4);
t.truthy(colors.gray5);
t.truthy(colors.gray6);
});