add failing test for .visible bug
This commit is contained in:
parent
6adf5794a3
commit
ede310303b
1 changed files with 23 additions and 0 deletions
|
|
@ -22,3 +22,26 @@ test('visible: no output when level is too low', t => {
|
|||
t.is(ctx.visible.red('foo'), '');
|
||||
t.is(ctx.red.visible('foo'), '');
|
||||
});
|
||||
|
||||
test('test switching back and forth between enabled and disabled', t => {
|
||||
const ctx = new m.constructor({level: 3, enabled: true});
|
||||
t.is(ctx.red('foo'), '\u001B[31mfoo\u001B[39m');
|
||||
t.is(ctx.visible.red('foo'), '\u001B[31mfoo\u001B[39m');
|
||||
t.is(ctx.red.visible('foo'), '\u001B[31mfoo\u001B[39m');
|
||||
t.is(ctx.visible('foo'), 'foo');
|
||||
t.is(ctx.red('foo'), '\u001B[31mfoo\u001B[39m');
|
||||
|
||||
ctx.enabled = false;
|
||||
t.is(ctx.red('foo'), 'foo');
|
||||
t.is(ctx.visible('foo'), '');
|
||||
t.is(ctx.visible.red('foo'), '');
|
||||
t.is(ctx.red.visible('foo'), '');
|
||||
t.is(ctx.red('foo'), 'foo');
|
||||
|
||||
ctx.enabled = true;
|
||||
t.is(ctx.red('foo'), '\u001B[31mfoo\u001B[39m');
|
||||
t.is(ctx.visible.red('foo'), '\u001B[31mfoo\u001B[39m');
|
||||
t.is(ctx.red.visible('foo'), '\u001B[31mfoo\u001B[39m');
|
||||
t.is(ctx.visible('foo'), 'foo');
|
||||
t.is(ctx.red('foo'), '\u001B[31mfoo\u001B[39m');
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue