Update to v13 and add queue and completely change code
This commit is contained in:
parent
dcef23d0ed
commit
55a38726a3
6706 changed files with 424137 additions and 61608 deletions
12
node_modules/cli-color/test/__playground/throbber.formatted.js
generated
vendored
Executable file
12
node_modules/cli-color/test/__playground/throbber.formatted.js
generated
vendored
Executable file
|
@ -0,0 +1,12 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
'use strict';
|
||||
|
||||
var setupThrobber = require('../../throbber')
|
||||
, format = require('../../index').red
|
||||
|
||||
, throbber = setupThrobber(process.stdout.write.bind(process.stdout), 200, format);
|
||||
|
||||
process.stdout.write('START');
|
||||
throbber.start();
|
||||
setTimeout(throbber.stop, 1100);
|
11
node_modules/cli-color/test/__playground/throbber.js
generated
vendored
Executable file
11
node_modules/cli-color/test/__playground/throbber.js
generated
vendored
Executable file
|
@ -0,0 +1,11 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
'use strict';
|
||||
|
||||
var setupThrobber = require('../../throbber')
|
||||
|
||||
, throbber = setupThrobber(process.stdout.write.bind(process.stdout), 200);
|
||||
|
||||
process.stdout.write('START');
|
||||
throbber.start();
|
||||
setTimeout(throbber.stop, 1100);
|
28
node_modules/cli-color/test/art.js
generated
vendored
Normal file
28
node_modules/cli-color/test/art.js
generated
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
'use strict';
|
||||
|
||||
var clc = require('../');
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(t('ooo', { o: clc.yellow("x") }),
|
||||
'\x1b[33mx\x1b[39m\x1b[33mx\x1b[39m\x1b[33mx\x1b[39m',
|
||||
"Basic art");
|
||||
|
||||
a(t('oyo', { o: clc.yellow("x") }),
|
||||
'\x1b[33mx\x1b[39my\x1b[33mx\x1b[39m',
|
||||
"Free text art");
|
||||
a(t('o o', { o: clc.yellow("x") }),
|
||||
'\x1b[33mx\x1b[39m \x1b[33mx\x1b[39m',
|
||||
"Spaced art");
|
||||
|
||||
a(t('<=>', { "<": clc.yellow("<"), ">": clc.yellow(">") }),
|
||||
'\x1b[33m<\x1b[39m=\x1b[33m>\x1b[39m',
|
||||
"Symbol art");
|
||||
|
||||
a(t('o\no', { o: clc.yellow("x") }),
|
||||
'\x1b[33mx\x1b[39m\n\x1b[33mx\x1b[39m',
|
||||
"Multiline art");
|
||||
|
||||
a(t('ooo', {}),
|
||||
'ooo',
|
||||
"Only text art");
|
||||
};
|
284
node_modules/cli-color/test/bare.js
generated
vendored
Normal file
284
node_modules/cli-color/test/bare.js
generated
vendored
Normal file
|
@ -0,0 +1,284 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var x, y;
|
||||
|
||||
a(t('test'), 'test', "Plain");
|
||||
a(t('test', 'foo', 3, { toString: function () { return 'bar'; } }),
|
||||
'test foo 3 bar', "Plain: Many args");
|
||||
|
||||
a(t.red('foo'), '\x1b[31mfoo\x1b[39m', "Foreground");
|
||||
a(t.red('foo', 'bar', 3), '\x1b[31mfoo bar 3\x1b[39m',
|
||||
"Foreground: Many args");
|
||||
a(t.red.yellow('foo', 'bar', 3), '\x1b[33mfoo bar 3\x1b[39m',
|
||||
"Foreground: Overriden");
|
||||
a(t.bgRed('foo', 'bar'), '\x1b[41mfoo bar\x1b[49m', "Background");
|
||||
a(t.bgRed.bgYellow('foo', 'bar', 3), '\x1b[43mfoo bar 3\x1b[49m',
|
||||
"Background: Overriden");
|
||||
|
||||
a(t.blue.bgYellow('foo', 'bar'), '\x1b[43m\x1b[34mfoo bar\x1b[39m\x1b[49m',
|
||||
"Foreground & Background");
|
||||
a(t.blue.bgYellow.red.bgMagenta('foo', 'bar'),
|
||||
'\x1b[45m\x1b[31mfoo bar\x1b[39m\x1b[49m',
|
||||
"Foreground & Background: Overriden");
|
||||
|
||||
a(t.bold('foo', 'bar'), '\x1b[1mfoo bar\x1b[22m', "Format");
|
||||
a(t.blink('foobar'), '\x1b[5mfoobar\x1b[25m', "Format: blink");
|
||||
a(t.bold.blue('foo', 'bar', 3), '\x1b[1m\x1b[34mfoo bar 3\x1b[39m\x1b[22m',
|
||||
"Foreground & Format");
|
||||
|
||||
a(t.redBright('foo', 'bar'), '\x1b[91mfoo bar\x1b[39m', "Bright");
|
||||
a(t.bgRedBright('foo', 3), '\x1b[101mfoo 3\x1b[49m', "Bright background");
|
||||
|
||||
a(t.blueBright.bgYellowBright.red.bgMagenta('foo', 'bar'),
|
||||
'\x1b[45m\x1b[31mfoo bar\x1b[39m\x1b[49m',
|
||||
"Foreground & Background: Bright: Overriden");
|
||||
|
||||
a(t.red.blue('foo'), '\x1b[34mfoo\x1b[39m', "Prioritize the Last Color: Blue");
|
||||
a(t.blue.red('foo'), '\x1b[31mfoo\x1b[39m', "Prioritize the Last Color: Red");
|
||||
a(t.bgRed.bgBlue('foo'), '\x1b[44mfoo\x1b[49m', "Prioritize the Last Background Color: Blue");
|
||||
a(t.bgBlue.bgRed('foo'), '\x1b[41mfoo\x1b[49m', "Prioritize the Last Background Color: Red");
|
||||
a(t.bgRed.red.bgBlue.blue('foo'),
|
||||
'\x1b[44m\x1b[34mfoo\x1b[39m\x1b[49m',
|
||||
"Prioritize the Last Mixed Style: Blue");
|
||||
a(t.bgBlue.blue.bgRed.red('foo'),
|
||||
'\x1b[41m\x1b[31mfoo\x1b[39m\x1b[49m',
|
||||
"Prioritize the Last Mixed Style: Red");
|
||||
a(t.bgRed.blue.bgBlue.red('foo'),
|
||||
'\x1b[44m\x1b[31mfoo\x1b[39m\x1b[49m',
|
||||
"Prioritize the Last Mixed Style: BG Blue and Red");
|
||||
a(t.bgBlue.red.bgRed.blue('foo'),
|
||||
'\x1b[41m\x1b[34mfoo\x1b[39m\x1b[49m',
|
||||
"Prioritize the Last Mixed Style: BG Red and Blue");
|
||||
|
||||
a(t.bold('bold ' + t.whiteBright('whiteBright ') + 'bold'),
|
||||
'\x1b[1mbold \x1b[97mwhiteBright \x1b[39mbold\x1b[22m',
|
||||
"Nested Format: Bold Type 1");
|
||||
a(t.white('white ' + t.bold('bold ') + 'white'),
|
||||
'\x1b[37mwhite \x1b[1mbold \x1b[22mwhite\x1b[39m',
|
||||
"Nested Format: Bold Type 2");
|
||||
|
||||
a(t.italic('italic ' + t.whiteBright('whiteBright ') + 'italic'),
|
||||
'\x1b[3mitalic \x1b[97mwhiteBright \x1b[39mitalic\x1b[23m',
|
||||
"Nested Format: Italic");
|
||||
a(t.white('white ' + t.italic('italic ') + 'white'),
|
||||
'\x1b[37mwhite \x1b[3mitalic \x1b[23mwhite\x1b[39m',
|
||||
"Nested Format: Italic Type 2");
|
||||
|
||||
a(t.underline('underline ' + t.whiteBright('whiteBright ') + 'underline'),
|
||||
'\x1b[4munderline \x1b[97mwhiteBright \x1b[39munderline\x1b[24m',
|
||||
"Nested Format: Underline");
|
||||
a(t.white('white ' + t.underline('underline ') + 'white'),
|
||||
'\x1b[37mwhite \x1b[4munderline \x1b[24mwhite\x1b[39m',
|
||||
"Nested Format: Underline Type 2");
|
||||
|
||||
a(t.blink('blink ' + t.whiteBright('whiteBright ') + 'blink'),
|
||||
'\x1b[5mblink \x1b[97mwhiteBright \x1b[39mblink\x1b[25m',
|
||||
"Nested Format: Blink");
|
||||
a(t.white('white ' + t.blink('blink ') + 'white'),
|
||||
'\x1b[37mwhite \x1b[5mblink \x1b[25mwhite\x1b[39m',
|
||||
"Nested Format: Blink Type 2");
|
||||
|
||||
a(t.inverse('inverse ' + t.whiteBright('whiteBright ') + 'inverse'),
|
||||
'\x1b[7minverse \x1b[97mwhiteBright \x1b[39minverse\x1b[27m',
|
||||
"Nested Format: Inverse");
|
||||
a(t.white('white ' + t.inverse('inverse ') + 'white'),
|
||||
'\x1b[37mwhite \x1b[7minverse \x1b[27mwhite\x1b[39m',
|
||||
"Nested Format: Inverse Type 2");
|
||||
|
||||
a(t.strike('strike ' + t.whiteBright('whiteBright ') + 'strike'),
|
||||
'\x1b[9mstrike \x1b[97mwhiteBright \x1b[39mstrike\x1b[29m',
|
||||
"Nested Format: Strike");
|
||||
a(t.white('white ' + t.strike('strike ') + 'white'),
|
||||
'\x1b[37mwhite \x1b[9mstrike \x1b[29mwhite\x1b[39m',
|
||||
"Nested Format: Strike Type 2");
|
||||
|
||||
a(t.red('red ' + t.blue('blue ')),
|
||||
'\x1b[31mred \x1b[34mblue \x1b[31m\x1b[39m',
|
||||
"Nested Foreground: Two Levels Type 1");
|
||||
a(t.red(t.blue('blue ') + 'red'),
|
||||
'\x1b[31m\x1b[34mblue \x1b[31mred\x1b[39m',
|
||||
"Nested Foreground: Two Levels Type 2");
|
||||
a(t.red('red ' + t.blue('blue ') + 'red'),
|
||||
'\x1b[31mred \x1b[34mblue \x1b[31mred\x1b[39m',
|
||||
"Nested Foreground: Two Levels Type 3");
|
||||
|
||||
a(t.red('red ' + t.blue('blue ' + t.green('green ')) + 'red'),
|
||||
'\x1b[31mred \x1b[34mblue \x1b[32mgreen \x1b[34m\x1b[31mred\x1b[39m',
|
||||
"Nested Foreground: Three Levels Type 1");
|
||||
a(t.red('red ' + t.blue('blue ' + t.green('green ') + 'blue ') + 'red'),
|
||||
'\x1b[31mred \x1b[34mblue \x1b[32mgreen \x1b[34mblue \x1b[31mred\x1b[39m',
|
||||
"Nested Foreground: Three Levels Type 2");
|
||||
a(t.red('red ' + t.blue('blue ' + t.green('green ')) + t.green('green ') + 'red'),
|
||||
'\x1b[31mred \x1b[34mblue \x1b[32mgreen \x1b[34m' +
|
||||
'\x1b[31m\x1b[32mgreen \x1b[31mred\x1b[39m',
|
||||
"Nested Foreground: Three Levels Type 3");
|
||||
a(t.red('red ' + t.blue('blue ' + t.green('green ') + t.yellow('yellow ')) + 'red'),
|
||||
'\x1b[31mred \x1b[34mblue \x1b[32mgreen \x1b[34m' +
|
||||
'\x1b[33myellow \x1b[34m\x1b[31mred\x1b[39m',
|
||||
"Nested Foreground: Three Levels Type 4");
|
||||
a(t.red('red ' + t.blue('blue ' + t.green('green ') + "blue " + t.yellow('yellow ')) + 'red'),
|
||||
'\x1b[31mred \x1b[34mblue \x1b[32mgreen \x1b[34mblue \x1b[33myellow ' +
|
||||
'\x1b[34m\x1b[31mred\x1b[39m', "Nested Foreground: Three Levels Type 5");
|
||||
|
||||
a(t.red('red ' + t.blue('blue ' + t.green('green ' + t.yellow('yellow ') + "green ")) + 'red'),
|
||||
'\x1b[31mred \x1b[34mblue \x1b[32mgreen \x1b[33myellow \x1b[32mgreen ' +
|
||||
'\x1b[34m\x1b[31mred\x1b[39m', "Nested Foreground: Four Levels");
|
||||
|
||||
a(t.red('\x1bAred'),
|
||||
'\x1b[31m\x1bAred\x1b[39m',
|
||||
"Nested Foreground: Trap Type 1 - Not a Style Before");
|
||||
a(t.red('red\x1bA'),
|
||||
'\x1b[31mred\x1bA\x1b[39m',
|
||||
"Nested Foreground: Trap Type 2 - Not a Style After");
|
||||
a(t.red('\x1bAred\x1bA'),
|
||||
'\x1b[31m\x1bAred\x1bA\x1b[39m',
|
||||
"Nested Foreground: Trap Type 3 - Not a Style Around");
|
||||
a(t.red('\x1b34m\x1b39m'),
|
||||
'\x1b[31m\x1b34m\x1b39m\x1b[39m',
|
||||
"Nested Foreground: Trap Type 4 - Not a Valid Style");
|
||||
a(t.red('\x1b[34m\x1b[39m'),
|
||||
'\x1b[31m\x1b[34m\x1b[31m\x1b[39m',
|
||||
"Nested Foreground: Trap Type 5 - No Message Style");
|
||||
a(t.red('\x1b[34m\x1b[39m\x1b[34mblue\x1b[39m'),
|
||||
'\x1b[31m\x1b[34m\x1b[31m\x1b[34mblue\x1b[31m\x1b[39m',
|
||||
"Nested Foreground: Trap Type 6 - No Message Style Before");
|
||||
a(t.red('\x1b[34mblue\x1b[39m\x1b[34m\x1b[39m'),
|
||||
'\x1b[31m\x1b[34mblue\x1b[31m\x1b[34m\x1b[31m\x1b[39m',
|
||||
"Nested Foreground: Trap Type 7 - No Message Style After");
|
||||
a(t.red('\x1b[34m\x1b[39m\x1b[34mblue\x1b[39m\x1b[34m\x1b[39m'),
|
||||
'\x1b[31m\x1b[34m\x1b[31m\x1b[34mblue\x1b[31m\x1b[34m\x1b[31m\x1b[39m',
|
||||
"Nested Foreground: Trap Type 8 - No Message Style Around");
|
||||
|
||||
a(t.bgRed('red ' + t.bgBlue('blue ')),
|
||||
'\x1b[41mred \x1b[44mblue \x1b[41m\x1b[49m',
|
||||
"Nested Background: Two Levels Type 1");
|
||||
a(t.bgRed(t.bgBlue('blue ') + 'red'),
|
||||
'\x1b[41m\x1b[44mblue \x1b[41mred\x1b[49m',
|
||||
"Nested Background: Two Levels Type 2");
|
||||
a(t.bgRed('red ' + t.bgBlue('blue ') + 'red'),
|
||||
'\x1b[41mred \x1b[44mblue \x1b[41mred\x1b[49m',
|
||||
"Nested Background: Two Levels Type 3");
|
||||
|
||||
a(t.bgRed('red ' + t.bgBlue('blue ' + t.bgGreen('green ')) + 'red'),
|
||||
'\x1b[41mred \x1b[44mblue \x1b[42mgreen \x1b[44m\x1b[41mred\x1b[49m',
|
||||
"Nested Background: Three Levels Type 1");
|
||||
a(t.bgRed('red ' + t.bgBlue('blue ' + t.bgGreen('green ') + 'blue ') + 'red'),
|
||||
'\x1b[41mred \x1b[44mblue \x1b[42mgreen \x1b[44mblue \x1b[41mred\x1b[49m',
|
||||
"Nested Background: Three Levels Type 2");
|
||||
a(t.bgRed('red ' + t.bgBlue('blue ' + t.bgGreen('green ')) + t.bgGreen('green ') + 'red'),
|
||||
'\x1b[41mred \x1b[44mblue \x1b[42mgreen \x1b[44m' +
|
||||
'\x1b[41m\x1b[42mgreen \x1b[41mred\x1b[49m',
|
||||
"Nested Background: Three Levels Type 3");
|
||||
a(t.bgRed('red ' + t.bgBlue('blue ' + t.bgGreen('green ') + t.bgYellow('yellow ')) + 'red'),
|
||||
'\x1b[41mred \x1b[44mblue \x1b[42mgreen \x1b[44m' +
|
||||
'\x1b[43myellow \x1b[44m\x1b[41mred\x1b[49m',
|
||||
"Nested Background: Three Levels Type 4");
|
||||
a(t.bgRed('red ' + t.bgBlue('blue ' + t.bgGreen('green ') + "blue " +
|
||||
t.bgYellow('yellow ')) + 'red'),
|
||||
'\x1b[41mred \x1b[44mblue \x1b[42mgreen \x1b[44mblue \x1b[43myellow ' +
|
||||
'\x1b[44m\x1b[41mred\x1b[49m', "Nested Background: Three Levels Type 5");
|
||||
|
||||
a(t.bgRed('red ' + t.bgBlue('blue ' + t.bgGreen('green ' +
|
||||
t.bgYellow('yellow ') + "green ")) + 'red'),
|
||||
'\x1b[41mred \x1b[44mblue \x1b[42mgreen \x1b[43myellow \x1b[42mgreen ' +
|
||||
'\x1b[44m\x1b[41mred\x1b[49m', "Nested Background: Four Levels");
|
||||
|
||||
a(t.bgRed('\x1bAred'),
|
||||
'\x1b[41m\x1bAred\x1b[49m',
|
||||
"Nested Background: Trap Type 1 - Not a Style Before");
|
||||
a(t.bgRed('red\x1bA'),
|
||||
'\x1b[41mred\x1bA\x1b[49m',
|
||||
"Nested Background: Trap Type 2 - Not a Style After");
|
||||
a(t.bgRed('\x1bAred\x1bA'),
|
||||
'\x1b[41m\x1bAred\x1bA\x1b[49m',
|
||||
"Nested Background: Trap Type 3 - Not a Style Around");
|
||||
a(t.bgRed('\x1b44m\x1b39m'),
|
||||
'\x1b[41m\x1b44m\x1b39m\x1b[49m',
|
||||
"Nested Background: Trap Type 4 - Not a Valid Style");
|
||||
a(t.bgRed('\x1b[44m\x1b[49m'),
|
||||
'\x1b[41m\x1b[44m\x1b[41m\x1b[49m',
|
||||
"Nested Background: Trap Type 5 - No Message Style");
|
||||
a(t.bgRed('\x1b[44m\x1b[49m\x1b[44mblue\x1b[49m'),
|
||||
'\x1b[41m\x1b[44m\x1b[41m\x1b[44mblue\x1b[41m\x1b[49m',
|
||||
"Nested Background: Trap Type 6 - No Message Style Before");
|
||||
a(t.bgRed('\x1b[44mblue\x1b[49m\x1b[44m\x1b[49m'),
|
||||
'\x1b[41m\x1b[44mblue\x1b[41m\x1b[44m\x1b[41m\x1b[49m',
|
||||
"Nested Background: Trap Type 7 - No Message Style After");
|
||||
a(t.bgRed('\x1b[44m\x1b[49m\x1b[44mblue\x1b[49m\x1b[44m\x1b[49m'),
|
||||
'\x1b[41m\x1b[44m\x1b[41m\x1b[44mblue\x1b[41m\x1b[44m\x1b[41m\x1b[49m',
|
||||
"Nested Background: Trap Type 8 - No Message Style Around");
|
||||
|
||||
a(t.red('red ' + t.bgBlue('blue ')),
|
||||
'\x1b[31mred \x1b[44mblue \x1b[49m\x1b[39m',
|
||||
"Nested Foreground and Background: Two Levels Type 1");
|
||||
a(t.red('red ' + t.bgBlue('blue ') + t.white('white')),
|
||||
'\x1b[31mred \x1b[44mblue \x1b[49m\x1b[37mwhite\x1b[31m\x1b[39m',
|
||||
"Nested Foreground and Background: Two Levels Type 2");
|
||||
a(t.red('red ' + t.bgBlue('blue ') + 'red'),
|
||||
'\x1b[31mred \x1b[44mblue \x1b[49mred\x1b[39m',
|
||||
"Nested Foreground and Background: Two Levels Type 3");
|
||||
a(t.bgBlue('blue ' + t.bgRed('red ' + t.whiteBright('white ') + 'red ') + 'blue'),
|
||||
'\x1b[44mblue \x1b[41mred \x1b[97mwhite \x1b[39mred \x1b[44mblue\x1b[49m',
|
||||
"Nested Foreground and Background: Two Levels Type 3");
|
||||
|
||||
a(t.red.bgWhite('white ' + t.bgBlue('blue')),
|
||||
'\x1b[47m\x1b[31mwhite \x1b[44mblue\x1b[47m\x1b[39m\x1b[49m',
|
||||
"Nested Foreground and Background: Mixed Type 1");
|
||||
a(t.red.bgWhite('white ' + t.blue('blue')),
|
||||
'\x1b[47m\x1b[31mwhite \x1b[34mblue\x1b[31m\x1b[39m\x1b[49m',
|
||||
"Nested Foreground and Background: Mixed Type 2");
|
||||
a(t.red.bgWhite('white ' + t.blue('blue ') + 'white'),
|
||||
'\x1b[47m\x1b[31mwhite \x1b[34mblue \x1b[31mwhite\x1b[39m\x1b[49m',
|
||||
"Nested Foreground and Background: Mixed Type 3");
|
||||
|
||||
a(t.red.bgWhite('\x1bAred'),
|
||||
'\x1b[47m\x1b[31m\x1bAred\x1b[39m\x1b[49m',
|
||||
"Nested Foreground and Background: Trap Type 1 - Not a Style Before");
|
||||
a(t.red.bgWhite('red\x1bA'),
|
||||
'\x1b[47m\x1b[31mred\x1bA\x1b[39m\x1b[49m',
|
||||
"Nested Foreground and Background: Trap Type 2 - Not a Style After");
|
||||
a(t.red.bgWhite('\x1bAred\x1bA'),
|
||||
'\x1b[47m\x1b[31m\x1bAred\x1bA\x1b[39m\x1b[49m',
|
||||
"Nested Foreground and Background: Trap Type 3 - Not a Style Around");
|
||||
a(t.red.bgWhite('\x1b34m\x1b39m'),
|
||||
'\x1b[47m\x1b[31m\x1b34m\x1b39m\x1b[39m\x1b[49m',
|
||||
"Nested Foreground and Background: Trap Type 4 - Not a Valid Style");
|
||||
a(t.red.bgWhite('\x1b[34m\x1b[39m'),
|
||||
'\x1b[47m\x1b[31m\x1b[34m\x1b[31m\x1b[39m\x1b[49m',
|
||||
"Nested Foreground and Background: Trap Type 5 - No Message Style");
|
||||
a(t.red.bgWhite('\x1b[44m\x1b[49m'),
|
||||
'\x1b[47m\x1b[31m\x1b[44m\x1b[47m\x1b[39m\x1b[49m',
|
||||
"Nested Foreground and Background: Trap Type 6 - No Message Style");
|
||||
a(t.red.bgWhite('\x1b[44m\x1b[49m\x1b[44mblue\x1b[49m'),
|
||||
'\x1b[47m\x1b[31m\x1b[44m\x1b[47m\x1b[44mblue\x1b[47m\x1b[39m\x1b[49m',
|
||||
"Nested Foreground and Background: Trap Type 7 - No Message Style Before");
|
||||
a(t.red.bgWhite('\x1b[44mblue\x1b[49m\x1b[44m\x1b[49m'),
|
||||
'\x1b[47m\x1b[31m\x1b[44mblue\x1b[47m\x1b[44m\x1b[47m\x1b[39m\x1b[49m',
|
||||
"Nested Foreground and Background: Trap Type 8 - No Message Style After");
|
||||
a(t.red.bgWhite('\x1b[44m\x1b[49m\x1b[44mblue\x1b[49m\x1b[44m\x1b[49m'),
|
||||
'\x1b[47m\x1b[31m\x1b[44m\x1b[47m\x1b[44mblue\x1b[47m\x1b[44m\x1b[47m\x1b[39m\x1b[49m',
|
||||
"Nested Foreground and Background: Trap Type 9 - No Message Style Around");
|
||||
|
||||
x = t.red;
|
||||
y = x.bold;
|
||||
|
||||
a(x('foo', 'red') + ' ' + y('foo', 'boldred'),
|
||||
'\x1b[31mfoo red\x1b[39m \x1b[1m\x1b[31mfoo boldred\x1b[39m\x1b[22m',
|
||||
"Detached extension");
|
||||
|
||||
if (t.xtermSupported) {
|
||||
a(t.xterm(12).bgXterm(67)('foo', 'xterm'),
|
||||
'\x1b[48;5;67m\x1b[38;5;12mfoo xterm\x1b[39m\x1b[49m', "Xterm");
|
||||
|
||||
a(t.redBright.bgBlueBright.xterm(12).bgXterm(67)('foo', 'xterm'),
|
||||
'\x1b[48;5;67m\x1b[38;5;12mfoo xterm\x1b[39m\x1b[49m',
|
||||
"Xterm: Override & Bright");
|
||||
a(t.xterm(12).bgXterm(67).redBright.bgMagentaBright('foo', 'xterm'),
|
||||
'\x1b[105m\x1b[91mfoo xterm\x1b[39m\x1b[49m',
|
||||
"Xterm: Override & Bright #2");
|
||||
} else {
|
||||
a(t.xterm(12).bgXterm(67)('foo', 'xterm'),
|
||||
'\x1b[100m\x1b[94mfoo xterm\x1b[39m\x1b[49m', "Xterm");
|
||||
}
|
||||
};
|
3
node_modules/cli-color/test/beep.js
generated
vendored
Normal file
3
node_modules/cli-color/test/beep.js
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = function (t, a) { a(t, '\x07'); };
|
32
node_modules/cli-color/test/columns.js
generated
vendored
Normal file
32
node_modules/cli-color/test/columns.js
generated
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(t([]), '\n', "Empty #1");
|
||||
a(t([ [], [], [] ]), '\n\n\n', "Empty #2");
|
||||
|
||||
a(t([ [ "A", "BC", "DEF" ] ]),
|
||||
'A | BC | DEF\n',
|
||||
"Header Only");
|
||||
|
||||
a(t([ [ "A", "BC", "DEF" ], [ 1, 23, 456 ] ]),
|
||||
'A | BC | DEF\n1 | 23 | 456\n',
|
||||
"Small items");
|
||||
a(t([ [ "A", "BC", "DEF" ], [ 12, 234, 4567 ] ]),
|
||||
'A | BC | DEF \n12 | 234 | 4567\n',
|
||||
"Large items");
|
||||
a(t([ [ "A", "BC", "DEF" ], [ 1234, 23456, 456789 ] ]),
|
||||
'A | BC | DEF \n1234 | 23456 | 456789\n',
|
||||
"Very large items");
|
||||
|
||||
a(t([ [ "A" ], [ 1 ], [ 23 ], [ 456 ] ]),
|
||||
'A \n1 \n23 \n456\n',
|
||||
"Single column");
|
||||
|
||||
a(t([ [ "ID" ], [ 1 ], [ 1, 23 ], [ 1, 23, 456 ] ]),
|
||||
'ID\n1 \n1 | 23\n1 | 23 | 456\n',
|
||||
"Force columns");
|
||||
|
||||
a(t([ [ "ID" ], [ "", "" ], [ 123, 123 ] ]),
|
||||
'ID \n | \n123 | 123\n',
|
||||
"Empty cells");
|
||||
};
|
6
node_modules/cli-color/test/erase.js
generated
vendored
Normal file
6
node_modules/cli-color/test/erase.js
generated
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(t.screen, '\x1b[2J');
|
||||
a(t.line, '\x1b[2K');
|
||||
};
|
16
node_modules/cli-color/test/get-stripped-length.js
generated
vendored
Normal file
16
node_modules/cli-color/test/get-stripped-length.js
generated
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var length = t;
|
||||
|
||||
a(typeof length, 'function');
|
||||
|
||||
a(length('ABC'), 3, "Works on plain string");
|
||||
a(length('\x1b[31mABC\x1b[39m'), 3, "Works on formatted string");
|
||||
a(length('\x1b[31mABC\x1b[39mDE'), 5, "Works on partially formatted string");
|
||||
a(length('\x1b[31mABC\x1b[39mDE'), 5, "Works on formatted string by couple of styles");
|
||||
|
||||
a(length('\x1b[31mABC\x1b[3mDE\x1b[23m\x1b[39m'), 5, "Works on nested formatted string");
|
||||
a(length('\x1b[31mAAA\x1b[32mBBB\x1b[31mAAA\x1b[39m'), 9,
|
||||
"Works on nested formatted string with overlapping styles");
|
||||
};
|
16
node_modules/cli-color/test/index.js
generated
vendored
Normal file
16
node_modules/cli-color/test/index.js
generated
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
'use strict';
|
||||
|
||||
var bareTests = require('./bare');
|
||||
|
||||
module.exports = function (t, a) {
|
||||
bareTests(t, a);
|
||||
|
||||
a(typeof t.windowSize.width, 'number', "Width");
|
||||
|
||||
a(t.move.up(34), '\x1b[34A', "Up: Positive");
|
||||
a(t.move(2, 35), '\x1b[2C\x1b[35B', "Move: two positives");
|
||||
|
||||
a(t.erase.screen, '\x1b[2J', "Erase");
|
||||
|
||||
a(t.beep, '\x07', "Beep");
|
||||
};
|
14
node_modules/cli-color/test/lib/sgr.js
generated
vendored
Normal file
14
node_modules/cli-color/test/lib/sgr.js
generated
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = function (sgr, a) {
|
||||
a(sgr(31), '\x1b[31m', "sgr creates set graphic rendition CSIs #1");
|
||||
a(sgr(39), '\x1b[39m', "sgr creates set graphic rendition CSIs #2");
|
||||
|
||||
a(sgr.hasCSI('\x1b[31mA\x1b[39m'), true, "sgr.hasCSI detecs CSIs in string #1");
|
||||
a(sgr.hasCSI('\x1b[31m'), true, "sgr.hasCSI detecs CSIs in string #2");
|
||||
a(sgr.hasCSI('[31m'), false, "sgr.hasCSI detecs CSIs in string #3");
|
||||
a(sgr.hasCSI('A'), false, "sgr.hasCSI detecs CSIs in string #4");
|
||||
|
||||
a(sgr.extractCode('\x1b[31m'), 31, "sgr.extractCode extract numeric code of CSI");
|
||||
a(sgr.extractCode('\x1b[39m'), 39, "sgr.extractCode extract numeric code of CSI");
|
||||
};
|
10
node_modules/cli-color/test/lib/xterm-colors.js
generated
vendored
Normal file
10
node_modules/cli-color/test/lib/xterm-colors.js
generated
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var re = /^[0-9a-f]{6}$/;
|
||||
|
||||
a(t.length, 256, "Length");
|
||||
t.forEach(function (data, index) {
|
||||
a(re.test(data), true, "In range #" + index);
|
||||
});
|
||||
};
|
9
node_modules/cli-color/test/lib/xterm-match.js
generated
vendored
Normal file
9
node_modules/cli-color/test/lib/xterm-match.js
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(t.length, 256, "Length");
|
||||
t.forEach(function (data, index) {
|
||||
a(((data >= 30) && (data <= 37)) || ((data >= 90) && (data <= 97)), true,
|
||||
"In range #" + index);
|
||||
});
|
||||
};
|
37
node_modules/cli-color/test/move.js
generated
vendored
Normal file
37
node_modules/cli-color/test/move.js
generated
vendored
Normal file
|
@ -0,0 +1,37 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(t.up(), '', "Up: No argument");
|
||||
a(t.up({}), '', "Up: Not a number");
|
||||
a(t.up(-34), '', "Up: Negative");
|
||||
a(t.up(34), '\x1b[34A', "Up: Positive");
|
||||
|
||||
a(t.down(), '', "Down: No argument");
|
||||
a(t.down({}), '', "Down: Not a number");
|
||||
a(t.down(-34), '', "Down: Negative");
|
||||
a(t.down(34), '\x1b[34B', "Down: Positive");
|
||||
|
||||
a(t.right(), '', "Right: No argument");
|
||||
a(t.right({}), '', "Right: Not a number");
|
||||
a(t.right(-34), '', "Right: Negative");
|
||||
a(t.right(34), '\x1b[34C', "Right: Positive");
|
||||
|
||||
a(t.left(), '', "Left: No argument");
|
||||
a(t.left({}), '', "Left: Not a number");
|
||||
a(t.left(-34), '', "Left: Negative");
|
||||
a(t.left(34), '\x1b[34D', "Left: Positive");
|
||||
|
||||
a(t(), '', "Move: No arguments");
|
||||
a(t({}, {}), '', "Move: Bad arguments");
|
||||
a(t({}, 12), '\x1b[12B', "Move: One direction");
|
||||
a(t(0, -12), '\x1b[12A', "Move: One negative direction");
|
||||
a(t(-42, -2), '\x1b[42D\x1b[2A', "Move: two negatives");
|
||||
a(t(2, 35), '\x1b[2C\x1b[35B', "Move: two positives");
|
||||
|
||||
a(t.to(), '\x1b[1;1H', "MoveTo: No arguments");
|
||||
a(t.to({}, {}), '\x1b[1;1H', "MoveTo: Bad arguments");
|
||||
a(t.to({}, 12), '\x1b[13;1H', "MoveTo: One direction");
|
||||
a(t.to(2, -12), '\x1b[1;3H', "MoveTo: One negative direction");
|
||||
a(t.to(-42, -2), '\x1b[1;1H', "MoveTo: two negatives");
|
||||
a(t.to(2, 35), '\x1b[36;3H', "MoveTo: two positives");
|
||||
};
|
5
node_modules/cli-color/test/reset.js
generated
vendored
Normal file
5
node_modules/cli-color/test/reset.js
generated
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(typeof t, 'string');
|
||||
};
|
92
node_modules/cli-color/test/slice.js
generated
vendored
Normal file
92
node_modules/cli-color/test/slice.js
generated
vendored
Normal file
|
@ -0,0 +1,92 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var slice = t;
|
||||
|
||||
a(typeof slice, 'function');
|
||||
|
||||
a(slice('ABCDE', 1), "BCDE", "Works on plain string");
|
||||
a(slice('ABCDE', -1), "E", "Works on plain string");
|
||||
a(slice('ABCDE', 1, 3), "BC", "Works on plain string");
|
||||
a(slice('ABCDE', -3, -1), "CD", "Works on plain string");
|
||||
|
||||
a(slice('\x1b[31mABCDE\x1b[39m', 1), "\x1b[31mBCDE\x1b[39m",
|
||||
"Works on whole single forecolor-styled string");
|
||||
a(slice('\x1b[31mABCDE\x1b[39m', -1), "\x1b[31mE\x1b[39m",
|
||||
"Works on whole single forecolor-styled string");
|
||||
a(slice('\x1b[31mABCDE\x1b[39m', 1, 3), "\x1b[31mBC\x1b[39m",
|
||||
"Works on whole single forecolor-styled string");
|
||||
a(slice('\x1b[31mABCDE\x1b[39m', -3, -1), "\x1b[31mCD\x1b[39m",
|
||||
"Works on whole single forecolor-styled string");
|
||||
|
||||
a(slice('\x1b[41mABCDE\x1b[49m', 1), "\x1b[41mBCDE\x1b[49m",
|
||||
"Works on whole single backcolor-styled string");
|
||||
a(slice('\x1b[41mABCDE\x1b[49m', -1), "\x1b[41mE\x1b[49m",
|
||||
"Works on whole single backcolor-styled string");
|
||||
a(slice('\x1b[41mABCDE\x1b[49m', 1, 3), "\x1b[41mBC\x1b[49m",
|
||||
"Works on whole single backcolor-styled string");
|
||||
a(slice('\x1b[41mABCDE\x1b[49m', -3, -1), "\x1b[41mCD\x1b[49m",
|
||||
"Works on whole single backcolor-styled string");
|
||||
|
||||
a(slice('ABC\x1b[31mDEF\x1b[39m', 0, 5), "ABC\x1b[31mDE\x1b[39m",
|
||||
"Save styles when chopping part of the forecolor-styled string");
|
||||
a(slice('ABC\x1b[31mDEF\x1b[39m', 1, 4), "BC\x1b[31mD\x1b[39m",
|
||||
"Save styles when chopping part of the forecolor-styled string");
|
||||
a(slice('ABC\x1b[31mDEF\x1b[39m', 1, 6), "BC\x1b[31mDEF\x1b[39m",
|
||||
"Save styles when chopping part of the forecolor-styled string");
|
||||
a(slice('ABC\x1b[31mDEF\x1b[39m', -5, -1), "BC\x1b[31mDE\x1b[39m",
|
||||
"Save styles when chopping part of the forecolor-styled string");
|
||||
|
||||
a(slice('ABC\x1b[41mDEF\x1b[49m', 0, 5), "ABC\x1b[41mDE\x1b[49m",
|
||||
"Save styles when chopping part of the backcolor-styled string");
|
||||
a(slice('ABC\x1b[41mDEF\x1b[49m', 1, 4), "BC\x1b[41mD\x1b[49m",
|
||||
"Save styles when chopping part of the backcolor-styled string");
|
||||
a(slice('ABC\x1b[41mDEF\x1b[49m', 1, 6), "BC\x1b[41mDEF\x1b[49m",
|
||||
"Save styles when chopping part of the backcolor-styled string");
|
||||
a(slice('ABC\x1b[41mDEF\x1b[49m', -5, -1), "BC\x1b[41mDE\x1b[49m",
|
||||
"Save styles when chopping part of the backcolor-styled string");
|
||||
|
||||
a(slice('\x1b[1mAAA\x1b[31mBBB\x1b[39mAAA\x1b[22m', 0, 5), "\x1b[1mAAA\x1b[31mBB\x1b[39m\x1b[22m",
|
||||
"Works with nested styles #1");
|
||||
a(slice('\x1b[1mAAA\x1b[31mBBB\x1b[39mAAA\x1b[22m', 2, 7), "\x1b[1mA\x1b[31mBBB\x1b[39mA\x1b[22m",
|
||||
"Works with nested styles #2");
|
||||
a(slice('\x1b[3mAAA\x1b[41mBBB\x1b[49mAAA\x1b[23m', 0, 5), "\x1b[3mAAA\x1b[41mBB\x1b[49m\x1b[23m",
|
||||
"Works with nested styles #3");
|
||||
a(slice('\x1b[3mAAA\x1b[41mBBB\x1b[49mAAA\x1b[23m', 2, 7), "\x1b[3mA\x1b[41mBBB\x1b[49mA\x1b[23m",
|
||||
"Works with nested styles #4");
|
||||
a(slice('\x1b[3mAAA\x1b[41mBBB\x1b[49mAAA\x1b[23m', -8, -1),
|
||||
"\x1b[3mAA\x1b[41mBBB\x1b[49mAA\x1b[23m",
|
||||
"Works with nested styles #5");
|
||||
|
||||
a(slice('\x1b[31mAAA\x1b[32mBBB\x1b[31mAAA\x1b[39m', 0, 5),
|
||||
"\x1b[31mAAA\x1b[32mBB\x1b[39m",
|
||||
"Works with nested overlapping styles #1");
|
||||
a(slice('\x1b[31mAAA\x1b[32mBBB\x1b[31mAAA\x1b[39m', 2, 7),
|
||||
"\x1b[31mA\x1b[32mBBB\x1b[31mA\x1b[39m",
|
||||
"Works with nested overlapping styles #2");
|
||||
a(slice('\x1b[31mAAA\x1b[32mBBB\x1b[31mAAA\x1b[39m', -8, -1),
|
||||
"\x1b[31mAA\x1b[32mBBB\x1b[31mAA\x1b[39m",
|
||||
"Works with nested overlapping styles #3");
|
||||
|
||||
/* CSI at the edge of slice */
|
||||
a(slice('ABC\x1b[31mDEF\x1b[39m', 3), "\x1b[31mDEF\x1b[39m", "Does not corrupt start CSI");
|
||||
a(slice('\x1b[41mABC\x1b[49mDEF', 0, 3), "\x1b[41mABC\x1b[49m", "Does not corrupt end CSI");
|
||||
|
||||
/* CSI-reducing tests */
|
||||
a(slice('ABC\x1b[31mDEF\x1b[39m', 0, 3), "ABC", "Does not mixin CSI to plain string");
|
||||
a(slice('ABCD\x1b[31mEF\x1b[39m', 0, 3), "ABC", "Does not mixin CSI to plain string");
|
||||
a(slice('\x1b[41mABC\x1b[49mDEF', 3), "DEF", "Does not mixin CSI to plain string");
|
||||
a(slice('\x1b[41mAB\x1b[49mCDEF', 3), "DEF", "Does not mixin CSI to plain string");
|
||||
|
||||
a(slice('A\x1b[31mBBB\x1b[39mD\x1b[32mE\x1b[39m', 2, 3), "\x1b[31mB\x1b[39m",
|
||||
"Does slice with surrounding styles");
|
||||
a(slice('A\x1b[31mBBB\x1b[39mD\x1b[32mE\x1b[39m', 0, 5), "A\x1b[31mBBB\x1b[39mD",
|
||||
"Does slice with inner styles");
|
||||
|
||||
a(slice('A\x1b[31mBBB\x1b[39m\x1b[2J\x1b[0;0H', 0, 4), "A\x1b[31mBBB\x1b[39m",
|
||||
"Remove reset CSI");
|
||||
|
||||
// 'A' + clc.red('BBB') + clc.erase.screen + clc.move.to(0, 0)
|
||||
a(slice('A\u001b[31mBBB\u001b[39m\u001b[2J\u001b[1;1H', 0, 4), "A\x1b[31mBBB\x1b[39m",
|
||||
"Remove control CSIs");
|
||||
};
|
98
node_modules/cli-color/test/strip.js
generated
vendored
Normal file
98
node_modules/cli-color/test/strip.js
generated
vendored
Normal file
|
@ -0,0 +1,98 @@
|
|||
'use strict';
|
||||
|
||||
var clc = require('../');
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var x = clc.red
|
||||
, y = x.bold;
|
||||
|
||||
a(t('test'), 'test', "Plain");
|
||||
|
||||
a(t('\x1bA'), '', "Simple Command Type 1");
|
||||
a(t('\x9bA'), '', "Simple Command Type 2");
|
||||
|
||||
a(t('\x1b[0A'), '', "Single Command");
|
||||
a(t('\x1b[0;A'), '', "Single Separated Command");
|
||||
a(t('\x1b[0;0A'), '', "Two Commands");
|
||||
a(t('\x1b[0;0;A'), '', "Two Separated Commands");
|
||||
|
||||
// Base on index tests.
|
||||
a(t(clc.red('foo')), 'foo', "Foreground");
|
||||
a(t(clc.red('foo', 'bar', 3)), 'foo bar 3', "Foreground: Many args");
|
||||
a(t(clc.red.yellow('foo', 'bar', 3)), 'foo bar 3', "Foreground: Overriden");
|
||||
a(t(clc.bgRed('foo', 'bar')), 'foo bar', "Background");
|
||||
a(t(clc.bgRed.bgYellow('foo', 'bar', 3)), 'foo bar 3', "Background: Overriden");
|
||||
|
||||
a(t(clc.blue.bgYellow('foo', 'bar')), 'foo bar', "Foreground & Background");
|
||||
a(t(clc.blue.bgYellow.red.bgMagenta('foo', 'bar')),
|
||||
'foo bar',
|
||||
"Foreground & Background: Overriden");
|
||||
|
||||
a(t(clc.bold('foo', 'bar')), 'foo bar', "Format");
|
||||
a(t(clc.blink('foobar')), 'foobar', "Format: blink");
|
||||
a(t(clc.bold.blue('foo', 'bar', 3)), 'foo bar 3', "Foreground & Format");
|
||||
|
||||
a(t(clc.redBright('foo', 'bar')), 'foo bar', "Bright");
|
||||
a(t(clc.bgRedBright('foo', 3)), 'foo 3', "Bright background");
|
||||
|
||||
a(t(clc.blueBright.bgYellowBright.red.bgMagenta('foo', 'bar')),
|
||||
'foo bar',
|
||||
"Foreground & Background: Bright: Overriden");
|
||||
|
||||
a(t(clc.red.blue('foo')), 'foo', "Prioritize the Last Color: Blue");
|
||||
a(t(clc.blue.red('foo')), 'foo', "Prioritize the Last Color: Red");
|
||||
a(t(clc.bgRed.bgBlue('foo')), 'foo', "Prioritize the Last Background Color: Blue");
|
||||
a(t(clc.bgBlue.bgRed('foo')), 'foo', "Prioritize the Last Background Color: Red");
|
||||
a(t(clc.bgRed.red.bgBlue.blue('foo')), 'foo', "Prioritize the Last Mixed Style: Blue");
|
||||
a(t(clc.bgBlue.blue.bgRed.red('foo')), 'foo', "Prioritize the Last Mixed Style: Red");
|
||||
a(t(clc.bgRed.blue.bgBlue.red('foo')),
|
||||
'foo',
|
||||
"Prioritize the Last Mixed Style: BG Blue and Red");
|
||||
a(t(clc.bgBlue.red.bgRed.blue('foo')),
|
||||
'foo',
|
||||
"Prioritize the Last Mixed Style: BG Red and Blue");
|
||||
|
||||
a(t(x('foo', 'red') + ' ' + y('foo', 'boldred')),
|
||||
'foo red foo boldred',
|
||||
"Detached extension");
|
||||
|
||||
a(t(clc.erase.screen).replace(/\n/g, ''), '', "Reset");
|
||||
|
||||
a(t(clc.move.up()), '', "Up: No argument");
|
||||
a(t(clc.move.up({})), '', "Up: Not a number");
|
||||
a(t(clc.move.up(-34)), '', "Up: Negative");
|
||||
a(t(clc.move.up(34)), '', "Up: Positive");
|
||||
|
||||
a(t(clc.move.down()), '', "Down: No argument");
|
||||
a(t(clc.move.down({})), '', "Down: Not a number");
|
||||
a(t(clc.move.down(-34)), '', "Down: Negative");
|
||||
a(t(clc.move.down(34)), '', "Down: Positive");
|
||||
|
||||
a(t(clc.move.right()), '', "Right: No argument");
|
||||
a(t(clc.move.right({})), '', "Right: Not a number");
|
||||
a(t(clc.move.right(-34)), '', "Right: Negative");
|
||||
a(t(clc.move.right(34)), '', "Right: Positive");
|
||||
|
||||
a(t(clc.move.left()), '', "Left: No argument");
|
||||
a(t(clc.move.left({})), '', "Left: Not a number");
|
||||
a(t(clc.move.left(-34)), '', "Left: Negative");
|
||||
a(t(clc.move.left(34)), '', "Left: Positive");
|
||||
|
||||
a(t(clc.move()), '', "Move: No arguments");
|
||||
a(t(clc.move({}, {})), '', "Move: Bad arguments");
|
||||
a(t(clc.move({}, 12)), '', "Move: One direction");
|
||||
a(t(clc.move(0, -12)), '', "Move: One negative direction");
|
||||
a(t(clc.move(-42, -2)), '', "Move: two negatives");
|
||||
a(t(clc.move(2, 35)), '', "Move: two positives");
|
||||
|
||||
a(t(clc.move.to()), '', "MoveTo: No arguments");
|
||||
a(t(clc.move.to({}, {})), '', "MoveTo: Bad arguments");
|
||||
a(t(clc.move.to({}, 12)), '', "MoveTo: One direction");
|
||||
a(t(clc.move.to(2, -12)), '', "MoveTo: One negative direction");
|
||||
a(t(clc.move.to(-42, -2)), '', "MoveTo: two negatives");
|
||||
a(t(clc.move.to(2, 35)), '', "MoveTo: two positives");
|
||||
|
||||
a(t(clc.beep), clc.beep, "Beep");
|
||||
|
||||
a(t('test'), 'test', "Plain");
|
||||
};
|
45
node_modules/cli-color/test/throbber.js
generated
vendored
Normal file
45
node_modules/cli-color/test/throbber.js
generated
vendored
Normal file
|
@ -0,0 +1,45 @@
|
|||
'use strict';
|
||||
|
||||
var startsWith = require('es5-ext/string/#/starts-with')
|
||||
, spawn = require('child_process').spawn
|
||||
, resolve = require('path').resolve
|
||||
, pg = resolve(__dirname, '__playground');
|
||||
|
||||
module.exports = {
|
||||
"": function (a, d) {
|
||||
var t = spawn('node', [resolve(pg, 'throbber.js')])
|
||||
, out = [], err = '';
|
||||
|
||||
t.stdout.on('data', function (data) {
|
||||
out.push(data);
|
||||
});
|
||||
t.stderr.on('data', function (data) {
|
||||
err += data;
|
||||
});
|
||||
t.on('exit', function () {
|
||||
a.ok(out.length > 4, "Interval");
|
||||
a(startsWith.call(out.join(""), "START-\b\\\b|\b/\b-\b"), true, "Output");
|
||||
a(err, "", "No stderr output");
|
||||
d();
|
||||
});
|
||||
},
|
||||
Formatted: function (a, d) {
|
||||
var t = spawn('node', [resolve(pg, 'throbber.formatted.js')])
|
||||
, out = [], err = '';
|
||||
|
||||
t.stdout.on('data', function (data) {
|
||||
out.push(data);
|
||||
});
|
||||
t.stderr.on('data', function (data) {
|
||||
err += data;
|
||||
});
|
||||
t.on('exit', function () {
|
||||
a.ok(out.length > 4, "Interval");
|
||||
a(startsWith.call(out.join(""), "START\x1b[31m-\x1b[39m\x1b[31m\b\\\x1b" +
|
||||
"[39m\x1b[31m\b|\x1b[39m\x1b[31m\b/\x1b[39m\x1b[31m\b-\x1b[39m"),
|
||||
true, "Output");
|
||||
a(err, "", "No stderr output");
|
||||
d();
|
||||
});
|
||||
}
|
||||
};
|
124
node_modules/cli-color/test/visual.js
generated
vendored
Normal file
124
node_modules/cli-color/test/visual.js
generated
vendored
Normal file
|
@ -0,0 +1,124 @@
|
|||
'use strict';
|
||||
|
||||
var clc = require('./')
|
||||
|
||||
, colors = [ 'black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white' ];
|
||||
|
||||
// Write some message.
|
||||
function w(message) {
|
||||
process.stdout.write(message);
|
||||
}
|
||||
|
||||
// Print colors.
|
||||
function printColors(title, style) {
|
||||
var j = colors.length
|
||||
, color
|
||||
, colorText
|
||||
, tint
|
||||
, i;
|
||||
|
||||
w(' > ' + clc.whiteBright(title) + ' ');
|
||||
for (i = 0; i < j; i++) {
|
||||
tint = clc;
|
||||
color = colors[i];
|
||||
colorText = color.toUpperCase();
|
||||
|
||||
if (style === 'foreground') {
|
||||
tint = tint[color];
|
||||
|
||||
if (color === 'black') {
|
||||
tint = tint.bgBlackBright;
|
||||
}
|
||||
}
|
||||
|
||||
if (style === 'foregroundBright') {
|
||||
tint = tint[color + 'Bright'];
|
||||
}
|
||||
|
||||
if (style === 'background') {
|
||||
tint = tint['bg' + color.slice(0, 1).toUpperCase() + color.slice(1)];
|
||||
|
||||
if (color === 'white') {
|
||||
tint = tint.whiteBright;
|
||||
}
|
||||
}
|
||||
|
||||
if (style === 'backgroundBright') {
|
||||
tint = tint['bg' + color.slice(0, 1).toUpperCase() + color.slice(1) + 'Bright'];
|
||||
}
|
||||
|
||||
w(tint(colorText) + ' ');
|
||||
}
|
||||
w('\n');
|
||||
}
|
||||
|
||||
// Smile test.
|
||||
w(clc.reset);
|
||||
|
||||
w('\n SMILE TEST\n\n');
|
||||
|
||||
// Yellow face.
|
||||
w(clc(" "));
|
||||
w(clc.bgYellowBright(" "));
|
||||
w(clc("\n"));
|
||||
w(clc(" "));
|
||||
w(clc.bgYellowBright(" "));
|
||||
w(clc("\n"));
|
||||
w(clc(" "));
|
||||
w(clc.bgYellowBright(" "));
|
||||
w(clc("\n"));
|
||||
w(clc(" "));
|
||||
w(clc.bgYellowBright(" "));
|
||||
w(clc("\n"));
|
||||
w(clc(" "));
|
||||
w(clc.bgYellowBright(" "));
|
||||
w(clc("\n"));
|
||||
w(clc(" "));
|
||||
w(clc.bgYellowBright(" "));
|
||||
w(clc("\n"));
|
||||
|
||||
// Move blue eyes.
|
||||
w(clc.move(7, -5));
|
||||
w(clc.blueBright.bgYellowBright("O"));
|
||||
w(clc.move(1, 0));
|
||||
w(clc.blueBright.bgYellowBright("O"));
|
||||
|
||||
// Red nose.
|
||||
w(clc.move.to(8, 5));
|
||||
w(clc.redBright.bgYellowBright("\u25A0"));
|
||||
|
||||
// Red mouth.
|
||||
w(clc.move.down(2));
|
||||
w(clc.move.left(2));
|
||||
w(clc.red.bgYellowBright("\u2588\u2584\u2588"));
|
||||
|
||||
// Move back.
|
||||
w(clc.move.to(0, 9));
|
||||
|
||||
// Colors test.
|
||||
w('\n COLORS TESTS\n');
|
||||
printColors('FOREGROUNDS (DEFAULT)', 'foreground');
|
||||
printColors('FOREGROUNDS (BRIGHT) ', 'foregroundBright');
|
||||
printColors('BACKGROUNDS (DEFAULT)', 'background');
|
||||
printColors('BACKGROUNDS (BRIGHT) ', 'backgroundBright');
|
||||
|
||||
// // Art test.
|
||||
w('\n ART TESTS\n\n');
|
||||
w(clc.art('\t.01111111112.\n' +
|
||||
'\t.3.........3.\n' +
|
||||
'\t.3.........3.\n' +
|
||||
'\t.41111111115.\n', {
|
||||
"0": clc.bgBlue.yellowBright('\u2554'),
|
||||
"1": clc.bgBlue.yellowBright('\u2550'),
|
||||
"2": clc.bgBlue.yellowBright('\u2557'),
|
||||
"3": clc.bgBlue.yellowBright('\u2551'),
|
||||
"4": clc.bgBlue.yellowBright('\u255A'),
|
||||
"5": clc.bgBlue.yellowBright('\u255D'),
|
||||
".": clc.bgBlue(' ')
|
||||
}));
|
||||
w(clc.move(11, -3));
|
||||
w(clc.bgBlue.whiteBright("Hello"));
|
||||
w(clc.move(-3, 1));
|
||||
w(clc.bgBlue.whiteBright("World"));
|
||||
w(clc.move(0, 2));
|
||||
w('\n');
|
8
node_modules/cli-color/test/window-size.js
generated
vendored
Normal file
8
node_modules/cli-color/test/window-size.js
generated
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(typeof t.width, 'number', "Width");
|
||||
a(typeof t.height, 'number', "Height");
|
||||
a(t.width >= 0, true);
|
||||
a(t.height >= 0, true);
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue