check parent builder object for enabled status (#142)
This commit is contained in:
parent
5a69476142
commit
0d2144904b
2 changed files with 35 additions and 1 deletions
22
test.js
22
test.js
|
|
@ -138,6 +138,28 @@ describe('chalk.enabled', function () {
|
|||
assert.equal(chalk.red('foo'), 'foo');
|
||||
chalk.enabled = true;
|
||||
});
|
||||
|
||||
it('should enable/disable colors based on overall chalk enabled property, not individual instances', function () {
|
||||
chalk.enabled = true;
|
||||
var red = chalk.red;
|
||||
assert.equal(red.enabled, true);
|
||||
chalk.enabled = false;
|
||||
assert.equal(red.enabled, chalk.enabled);
|
||||
chalk.enabled = true;
|
||||
});
|
||||
|
||||
it('should propagate enable/disable changes from child colors', function () {
|
||||
chalk.enabled = true;
|
||||
var red = chalk.red;
|
||||
assert.equal(red.enabled, true);
|
||||
assert.equal(chalk.enabled, true);
|
||||
red.enabled = false;
|
||||
assert.equal(red.enabled, false);
|
||||
assert.equal(chalk.enabled, false);
|
||||
chalk.enabled = true;
|
||||
assert.equal(red.enabled, true);
|
||||
assert.equal(chalk.enabled, true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('chalk.constructor', function () {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue