@tuidom/testing 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -0
- package/package.json +3 -3
package/README.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# @tuidom/testing
|
|
2
|
+
|
|
3
|
+
Test harness for [TUIDom](https://github.com/tuidom/tuidom) hosts — the same
|
|
4
|
+
one TUIDom's own suite uses: `TestApp` (scripted app loop), `renderElement`
|
|
5
|
+
(single-shot render), `expectScreen` assertions, `MockTerminalBackend`, and a
|
|
6
|
+
Dark+ palette snapshot so style tokens resolve to real colors.
|
|
7
|
+
|
|
8
|
+
> ⚠️ Experimental — the API is unstable, deep imports expose internals on purpose.
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
npm install --save-dev @tuidom/testing
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
import { BoxElement } from "@tuidom/elements/layout/boxElement";
|
|
16
|
+
import { expectScreen, screen } from "@tuidom/testing/expectScreen";
|
|
17
|
+
import { renderElement } from "@tuidom/testing/renderElement";
|
|
18
|
+
import { TestApp } from "@tuidom/testing/TestApp";
|
|
19
|
+
|
|
20
|
+
const backend = renderElement(new BoxElement(), 6, 3);
|
|
21
|
+
expectScreen(
|
|
22
|
+
backend,
|
|
23
|
+
screen`
|
|
24
|
+
+----+
|
|
25
|
+
| |
|
|
26
|
+
+----+
|
|
27
|
+
`,
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
const app = TestApp.createWithContent(new BoxElement());
|
|
31
|
+
app.sendKey("Tab");
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
`TestApp` also validates tree invariants after every frame.
|
|
35
|
+
|
|
36
|
+
Full guide: <https://github.com/tuidom/tuidom/blob/main/GUIDE.md>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tuidom/testing",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Experimental terminal UI DOM — test harness: TestApp, renderElement, expectScreen, mock terminal backend. API is unstable.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"./*": "./dist/*.js"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@tuidom/core": "0.1
|
|
32
|
-
"@tuidom/elements": "0.1
|
|
31
|
+
"@tuidom/core": "0.2.1",
|
|
32
|
+
"@tuidom/elements": "0.2.1"
|
|
33
33
|
}
|
|
34
34
|
}
|