Skip to content

Commit

Permalink
Amended #tips and ...
Browse files Browse the repository at this point in the history
  • Loading branch information
simphotonics committed Sep 11, 2023
1 parent dda0ca4 commit 16f2e70
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@ replacement modes that can be adjusted using the optional argument `method`.
* Ansi codes can be combined using the addition operator `Anis.red + Ansi.bold`,
or by using the factory constructor `Ansi.combine`.

* Ansi output can be globally disabled by setting
`Ansi.status = AnsiOutput.disabled` or by using the option:
```Console
$ dart --define=isMonochrome=true example/bin/color_example.dart

```

## Features and bugs

If some Ansi modifiers are missing please file an enhancement request
Expand Down
21 changes: 21 additions & 0 deletions test/ansi_modifier_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@ void main() {
expect((redMoon + greenPlanet).clearStyle(), moon + planet);
});
});
group('Reset:', () {
test('replace starting', () {
expect(
('The ' + 'fox'.style(Ansi.bold)).style(Ansi.reset),
startsWith(
Ansi.reset.code,
));
});
});
group('Replace:', () {
test('starting', () {
expect(
Expand Down Expand Up @@ -75,4 +84,16 @@ void main() {
);
});
});
group('Ansi output', () {
test('enabled', () {
Ansi.status = AnsiOutput.enabled;
expect('string'.style(Ansi.bold), startsWith(Ansi.bold.code));
expect('string'.style(Ansi.bold), endsWith(Ansi.reset.code));
});
test('disabled', () {
Ansi.status = AnsiOutput.disabled;
expect('string'.style(Ansi.bold), startsWith('str'));
expect('string'.style(Ansi.bold), endsWith('ing'));
});
});
}

0 comments on commit 16f2e70

Please sign in to comment.