Skip to content

Commit a98deca

Browse files
committed
Add tests for custom entries with multiple values
1 parent dee3ab0 commit a98deca

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

tests/basic-test.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,13 @@ assert.equal(typeof ('astring'.red), 'string');
6161
assert.equal(typeof ('astring'.error), 'string');
6262

6363
assert.equal(s, 'string');
64+
65+
colors.setTheme({custom: ['blue', 'bold', 'underline']});
66+
assert.equal(colors.custom(s),
67+
'\x1b[34m' + '\x1b[1m' + '\x1b[4m' + s +
68+
'\x1b[24m' + '\x1b[22m' + '\x1b[39m' );
69+
70+
colors.setTheme({custom: ['red', 'italic', 'inverse']});
71+
assert.equal(colors.custom(s),
72+
'\x1b[31m' + '\x1b[3m' + '\x1b[7m' + s +
73+
'\x1b[27m' + '\x1b[23m' + '\x1b[39m' );

tests/safe-test.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,12 @@ colors.setTheme({error: 'red'});
5757
assert.equal(typeof (colors.red('astring')), 'string');
5858
assert.equal(typeof (colors.error('astring')), 'string');
5959

60+
colors.setTheme({custom: ['blue', 'bold', 'underline']});
61+
assert.equal(colors.custom(s),
62+
'\x1b[4m' + '\x1b[1m' + '\x1b[34m' + s +
63+
'\x1b[39m' + '\x1b[22m' + '\x1b[24m' );
64+
65+
colors.setTheme({custom: ['red', 'italic', 'inverse']});
66+
assert.equal(colors.custom(s),
67+
'\x1b[7m' + '\x1b[3m' + '\x1b[31m' + s +
68+
'\x1b[39m' + '\x1b[23m' + '\x1b[27m' );

0 commit comments

Comments
 (0)