Merge branch 'master' of github.com:chalk/chalk into fix/nested-styling

This commit is contained in:
Ahad Birang 2019-07-12 22:26:08 +04:30
commit 93d8c7f980
25 changed files with 553 additions and 588 deletions

View file

@ -3,7 +3,7 @@ import test from 'ava';
// Spoof supports-color
require('./_supports-color')(__dirname);
const chalk = require('..');
const chalk = require('../source');
console.log('TERM:', process.env.TERM || '[none]');
console.log('platform:', process.platform || '[unknown]');
@ -82,6 +82,10 @@ test('line breaks should open and close colors', t => {
t.is(chalk.grey('hello\nworld'), '\u001B[90mhello\u001B[39m\n\u001B[90mworld\u001B[39m');
});
test('line breaks should open and close colors with CRLF', t => {
t.is(chalk.grey('hello\r\nworld'), '\u001B[90mhello\u001B[39m\r\n\u001B[90mworld\u001B[39m');
});
test('properly convert RGB to 16 colors on basic color terminals', t => {
t.is(new chalk.Instance({level: 1}).hex('#FF0000')('hello'), '\u001B[91mhello\u001B[39m');
t.is(new chalk.Instance({level: 1}).bgHex('#FF0000')('hello'), '\u001B[101mhello\u001B[49m');
@ -97,3 +101,7 @@ test('don\'t emit RGB codes if level is 0', t => {
t.is(new chalk.Instance({level: 0}).hex('#FF0000')('hello'), 'hello');
t.is(new chalk.Instance({level: 0}).bgHex('#FF0000')('hello'), 'hello');
});
test('supports blackBright color', t => {
t.is(chalk.blackBright('foo'), '\u001B[90mfoo\u001B[39m');
});