| 1 |
"use strict"; |
| 2 |
|
| 3 |
module.exports = function (t, a) { |
| 4 |
var length = t; |
| 5 |
|
| 6 |
a(typeof length, "function"); |
| 7 |
|
| 8 |
a(length("ABC"), 3, "Works on plain string"); |
| 9 |
a(length("\x1b[31mABC\x1b[39m"), 3, "Works on formatted string"); |
| 10 |
a(length("\x1b[31mABC\x1b[39mDE"), 5, "Works on partially formatted string"); |
| 11 |
a(length("\x1b[31mABC\x1b[39mDE"), 5, "Works on formatted string by couple of styles"); |
| 12 |
|
| 13 |
a(length("\x1b[31mABC\x1b[3mDE\x1b[23m\x1b[39m"), 5, "Works on nested formatted string"); |
| 14 |
a( |
| 15 |
length("\x1b[31mAAA\x1b[32mBBB\x1b[31mAAA\x1b[39m"), 9, |
| 16 |
"Works on nested formatted string with overlapping styles" |
| 17 |
); |
| 18 |
}; |