Debian Codegraph @

cli-color/test/lib/sgr.js

raw
1 "use strict";
2
3 module.exports = function (sgr, a) {
4 a(sgr(31), "\x1b[31m", "sgr creates set graphic rendition CSIs #1");
5 a(sgr(39), "\x1b[39m", "sgr creates set graphic rendition CSIs #2");
6
7 a(sgr.hasCSI("\x1b[31mA\x1b[39m"), true, "sgr.hasCSI detecs CSIs in string #1");
8 a(sgr.hasCSI("\x1b[31m"), true, "sgr.hasCSI detecs CSIs in string #2");
9 a(sgr.hasCSI("[31m"), false, "sgr.hasCSI detecs CSIs in string #3");
10 a(sgr.hasCSI("A"), false, "sgr.hasCSI detecs CSIs in string #4");
11
12 a(sgr.extractCode("\x1b[31m"), 31, "sgr.extractCode extract numeric code of CSI");
13 a(sgr.extractCode("\x1b[39m"), 39, "sgr.extractCode extract numeric code of CSI");
14 };