1 | var color = require('../lib/color');
|
2 | var paint = color.paint;
|
3 | var should = require('should');
|
4 | color.isatty = true;
|
5 |
|
6 | describe('Color', function() {
|
7 | it('should be supported', function() {
|
8 | should.exists(color.isSupported);
|
9 | });
|
10 | it('should be red hello', function() {
|
11 | paint('hello').red.color.should.equal('\x1b[31mhello\x1b[39m');
|
12 | paint('hello').red.style.should.equal('\x1b[31mhello\x1b[39m');
|
13 | });
|
14 | it('should be colorful string', function() {
|
15 | should.not.exists(String.prototype.to);
|
16 | color.colorful();
|
17 | should.exists(String.prototype.to);
|
18 | });
|
19 | it('should be underline red hello', function() {
|
20 | 'hello'.to.underline.red.color.should.equal('\x1b[31m\x1b[4mhello\x1b[24m\x1b[39m');
|
21 | 'hello'.to.underline.red.string.should.equal('hello');
|
22 | });
|
23 | });
|