Last change
on this file since 6a80231 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
892 bytes
|
Line | |
---|
1 | var test = require('tape');
|
---|
2 | var table = require('../');
|
---|
3 | var color = require('cli-color');
|
---|
4 | var ansiTrim = require('cli-color/lib/trim');
|
---|
5 |
|
---|
6 | test('center', function (t) {
|
---|
7 | t.plan(1);
|
---|
8 | var opts = {
|
---|
9 | align: [ 'l', 'c', 'l' ],
|
---|
10 | stringLength: function(s) { return ansiTrim(s).length }
|
---|
11 | };
|
---|
12 | var s = table([
|
---|
13 | [
|
---|
14 | color.red('Red'), color.green('Green'), color.blue('Blue')
|
---|
15 | ],
|
---|
16 | [
|
---|
17 | color.bold('Bold'), color.underline('Underline'),
|
---|
18 | color.italic('Italic')
|
---|
19 | ],
|
---|
20 | [
|
---|
21 | color.inverse('Inverse'), color.strike('Strike'),
|
---|
22 | color.blink('Blink')
|
---|
23 | ],
|
---|
24 | [ 'bar', '45', 'lmno' ]
|
---|
25 | ], opts);
|
---|
26 | t.equal(ansiTrim(s), [
|
---|
27 | 'Red Green Blue',
|
---|
28 | 'Bold Underline Italic',
|
---|
29 | 'Inverse Strike Blink',
|
---|
30 | 'bar 45 lmno'
|
---|
31 | ].join('\n'));
|
---|
32 | });
|
---|
Note:
See
TracBrowser
for help on using the repository browser.