forked from enviPath/enviPy
Current Dev State
This commit is contained in:
19
static/js/ketcher2/node_modules/cli-columns/test/_color.js
generated
vendored
Normal file
19
static/js/ketcher2/node_modules/cli-columns/test/_color.js
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
var chalk = require('chalk');
|
||||
var columns = require('../src/cli-columns.js');
|
||||
|
||||
var cols = columns(
|
||||
[
|
||||
'foo', 'bar', 'baz',
|
||||
chalk.cyan('嶜憃撊') + ' 噾噿嚁',
|
||||
'blue' + chalk.bgBlue('berry'),
|
||||
chalk.red('apple'), 'pomegranate',
|
||||
'durian', chalk.green('star fruit'),
|
||||
'apricot', 'banana pineapple'
|
||||
],
|
||||
{
|
||||
width: 80
|
||||
}
|
||||
);
|
||||
|
||||
// Visual test
|
||||
console.log(chalk.yellow(cols) + '\n');
|
||||
78
static/js/ketcher2/node_modules/cli-columns/test/cli-columns.js
generated
vendored
Normal file
78
static/js/ketcher2/node_modules/cli-columns/test/cli-columns.js
generated
vendored
Normal file
@ -0,0 +1,78 @@
|
||||
import test from 'ava';
|
||||
import chalk from 'chalk';
|
||||
import stripAnsi from 'strip-ansi';
|
||||
import columns from '../src/cli-columns';
|
||||
|
||||
test('should print one column list', async t => {
|
||||
var cols = columns(['foo', ['bar', 'baz'], ['bat', 'qux']], {
|
||||
width: 1
|
||||
});
|
||||
|
||||
var expected =
|
||||
'bar\n' +
|
||||
'bat\n' +
|
||||
'baz\n' +
|
||||
'foo\n' +
|
||||
'qux';
|
||||
|
||||
t.is(cols, expected);
|
||||
});
|
||||
|
||||
test('should print three column list', async t => {
|
||||
var cols = columns(['foo', ['bar', 'baz'], ['bat', 'qux']], {
|
||||
width: 16
|
||||
});
|
||||
|
||||
var expected =
|
||||
'bar baz qux \n' +
|
||||
'bat foo ';
|
||||
|
||||
t.is(cols, expected);
|
||||
});
|
||||
|
||||
test('should print complex list', async t => {
|
||||
var cols = columns(
|
||||
[
|
||||
'foo', 'bar', 'baz',
|
||||
chalk.cyan('嶜憃撊') + ' 噾噿嚁',
|
||||
'blue' + chalk.bgBlue('berry'),
|
||||
chalk.red('apple'), 'pomegranate',
|
||||
'durian', chalk.green('star fruit'),
|
||||
'apricot', 'banana pineapple'
|
||||
],
|
||||
{
|
||||
width: 80
|
||||
}
|
||||
);
|
||||
|
||||
var expected =
|
||||
'apple bar durian star fruit \n' +
|
||||
'apricot baz foo 嶜憃撊 噾噿嚁 \n' +
|
||||
'banana pineapple blueberry pomegranate ';
|
||||
|
||||
t.is(stripAnsi(cols), expected);
|
||||
});
|
||||
|
||||
test('should optionally not sort', async t => {
|
||||
var cols = columns(
|
||||
[
|
||||
'foo', 'bar', 'baz',
|
||||
chalk.cyan('嶜憃撊') + ' 噾噿嚁',
|
||||
'blue' + chalk.bgBlue('berry'),
|
||||
chalk.red('apple'), 'pomegranate',
|
||||
'durian', chalk.green('star fruit'),
|
||||
'apricot', 'banana pineapple'
|
||||
],
|
||||
{
|
||||
sort: false,
|
||||
width: 80
|
||||
}
|
||||
);
|
||||
|
||||
var expected =
|
||||
'foo 嶜憃撊 噾噿嚁 pomegranate apricot \n' +
|
||||
'bar blueberry durian banana pineapple \n' +
|
||||
'baz apple star fruit ';
|
||||
|
||||
t.is(stripAnsi(cols), expected);
|
||||
});
|
||||
Reference in New Issue
Block a user