1 | "use strict";
|
2 |
|
3 | var clc = require("../");
|
4 |
|
5 | module.exports = function (t, a) {
|
6 | var x = clc.red
|
7 | , y = x.bold;
|
8 |
|
9 | a(t("test"), "test", "Plain");
|
10 |
|
11 | a(t("\x1bA"), "", "Simple Command Type 1");
|
12 | a(t("\x9bA"), "", "Simple Command Type 2");
|
13 |
|
14 | a(t("\x1b[0A"), "", "Single Command");
|
15 | a(t("\x1b[0;A"), "", "Single Separated Command");
|
16 | a(t("\x1b[0;0A"), "", "Two Commands");
|
17 | a(t("\x1b[0;0;A"), "", "Two Separated Commands");
|
18 |
|
19 |
|
20 | a(t(clc.red("foo")), "foo", "Foreground");
|
21 | a(t(clc.red("foo", "bar", 3)), "foo bar 3", "Foreground: Many args");
|
22 | a(t(clc.red.yellow("foo", "bar", 3)), "foo bar 3", "Foreground: Overriden");
|
23 | a(t(clc.bgRed("foo", "bar")), "foo bar", "Background");
|
24 | a(t(clc.bgRed.bgYellow("foo", "bar", 3)), "foo bar 3", "Background: Overriden");
|
25 |
|
26 | a(t(clc.blue.bgYellow("foo", "bar")), "foo bar", "Foreground & Background");
|
27 | a(t(clc.blue.bgYellow.red.bgMagenta("foo", "bar")),
|
28 | "foo bar",
|
29 | "Foreground & Background: Overriden");
|
30 |
|
31 | a(t(clc.bold("foo", "bar")), "foo bar", "Format");
|
32 | a(t(clc.blink("foobar")), "foobar", "Format: blink");
|
33 | a(t(clc.bold.blue("foo", "bar", 3)), "foo bar 3", "Foreground & Format");
|
34 |
|
35 | a(t(clc.redBright("foo", "bar")), "foo bar", "Bright");
|
36 | a(t(clc.bgRedBright("foo", 3)), "foo 3", "Bright background");
|
37 |
|
38 | a(t(clc.blueBright.bgYellowBright.red.bgMagenta("foo", "bar")),
|
39 | "foo bar",
|
40 | "Foreground & Background: Bright: Overriden");
|
41 |
|
42 | a(t(clc.red.blue("foo")), "foo", "Prioritize the Last Color: Blue");
|
43 | a(t(clc.blue.red("foo")), "foo", "Prioritize the Last Color: Red");
|
44 | a(t(clc.bgRed.bgBlue("foo")), "foo", "Prioritize the Last Background Color: Blue");
|
45 | a(t(clc.bgBlue.bgRed("foo")), "foo", "Prioritize the Last Background Color: Red");
|
46 | a(t(clc.bgRed.red.bgBlue.blue("foo")), "foo", "Prioritize the Last Mixed Style: Blue");
|
47 | a(t(clc.bgBlue.blue.bgRed.red("foo")), "foo", "Prioritize the Last Mixed Style: Red");
|
48 | a(t(clc.bgRed.blue.bgBlue.red("foo")),
|
49 | "foo",
|
50 | "Prioritize the Last Mixed Style: BG Blue and Red");
|
51 | a(t(clc.bgBlue.red.bgRed.blue("foo")),
|
52 | "foo",
|
53 | "Prioritize the Last Mixed Style: BG Red and Blue");
|
54 |
|
55 | a(t(x("foo", "red") + " " + y("foo", "boldred")),
|
56 | "foo red foo boldred",
|
57 | "Detached extension");
|
58 |
|
59 | a(t(clc.erase.screen).replace(/\n/g, ""), "", "Reset");
|
60 |
|
61 | a(t(clc.move.up()), "", "Up: No argument");
|
62 | a(t(clc.move.up({})), "", "Up: Not a number");
|
63 | a(t(clc.move.up(-34)), "", "Up: Negative");
|
64 | a(t(clc.move.up(34)), "", "Up: Positive");
|
65 |
|
66 | a(t(clc.move.down()), "", "Down: No argument");
|
67 | a(t(clc.move.down({})), "", "Down: Not a number");
|
68 | a(t(clc.move.down(-34)), "", "Down: Negative");
|
69 | a(t(clc.move.down(34)), "", "Down: Positive");
|
70 |
|
71 | a(t(clc.move.right()), "", "Right: No argument");
|
72 | a(t(clc.move.right({})), "", "Right: Not a number");
|
73 | a(t(clc.move.right(-34)), "", "Right: Negative");
|
74 | a(t(clc.move.right(34)), "", "Right: Positive");
|
75 |
|
76 | a(t(clc.move.left()), "", "Left: No argument");
|
77 | a(t(clc.move.left({})), "", "Left: Not a number");
|
78 | a(t(clc.move.left(-34)), "", "Left: Negative");
|
79 | a(t(clc.move.left(34)), "", "Left: Positive");
|
80 |
|
81 | a(t(clc.move()), "", "Move: No arguments");
|
82 | a(t(clc.move({}, {})), "", "Move: Bad arguments");
|
83 | a(t(clc.move({}, 12)), "", "Move: One direction");
|
84 | a(t(clc.move(0, -12)), "", "Move: One negative direction");
|
85 | a(t(clc.move(-42, -2)), "", "Move: two negatives");
|
86 | a(t(clc.move(2, 35)), "", "Move: two positives");
|
87 |
|
88 | a(t(clc.move.to()), "", "MoveTo: No arguments");
|
89 | a(t(clc.move.to({}, {})), "", "MoveTo: Bad arguments");
|
90 | a(t(clc.move.to({}, 12)), "", "MoveTo: One direction");
|
91 | a(t(clc.move.to(2, -12)), "", "MoveTo: One negative direction");
|
92 | a(t(clc.move.to(-42, -2)), "", "MoveTo: two negatives");
|
93 | a(t(clc.move.to(2, 35)), "", "MoveTo: two positives");
|
94 |
|
95 | a(t(clc.beep), clc.beep, "Beep");
|
96 |
|
97 | a(t("test"), "test", "Plain");
|
98 | };
|