forked from orbit-oss/chalk
return a new function for each getter
- defines the getters onto a proto - the function returned has its __proto__ set to our proto fixes #32
This commit is contained in:
parent
3073fa3110
commit
42918337e5
4 changed files with 34 additions and 6 deletions
11
test.js
11
test.js
|
|
@ -32,6 +32,17 @@ describe('chalk', function () {
|
|||
assert.equal(chalk.reset(chalk.red.bgGreen.underline('foo') + 'foo'), '\u001b[0m\u001b[4m\u001b[42m\u001b[31mfoo\u001b[39m\u001b[49m\u001b[24mfoo\u001b[0m');
|
||||
});
|
||||
|
||||
it('should be able to cache multiple styles', function() {
|
||||
var red = chalk.red;
|
||||
var blue = chalk.blue;
|
||||
var redBold = red.bold;
|
||||
var blueBold = blue.bold;
|
||||
|
||||
assert.notEqual(red('foo'), blue('foo'));
|
||||
assert.notEqual(redBold('bar'), blueBold('bar'));
|
||||
assert.notEqual(blue('baz'), blueBold('baz'));
|
||||
});
|
||||
|
||||
it('should alias gray to grey', function () {
|
||||
assert.equal(chalk.grey('foo'), '\u001b[90mfoo\u001b[39m');
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue