@tuidom/testing 0.6.1 → 0.8.0

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.
@@ -1,4 +1,4 @@
1
- import type { ITerminalBackend } from "@tuidom/core/backend/iTerminalBackend";
1
+ import { type HostTerminalColors, type ITerminalBackend } from "@tuidom/core/backend/iTerminalBackend";
2
2
  import { Point, Size } from "@tuidom/core/common/geometryPromitives";
3
3
  import type { KeyPressEvent } from "@tuidom/core/input/keyEvent";
4
4
  import type { MouseToken } from "@tuidom/core/input/rawTerminalToken";
@@ -40,6 +40,13 @@ export declare class MockTerminalBackend implements ITerminalBackend {
40
40
  terminalVersion: string | undefined;
41
41
  /** Answers synchronously with {@link terminalVersion} — no terminal round-trip to wait for. */
42
42
  probeTerminalVersion(onResult: (nameAndVersion: string | undefined) => void): void;
43
+ /**
44
+ * What {@link probeHostColors} reports. Default: the terminal reported nothing.
45
+ * Set it before the app probes.
46
+ */
47
+ hostColors: HostTerminalColors;
48
+ /** Answers synchronously with {@link hostColors} — no terminal round-trip to wait for. */
49
+ probeHostColors(onResult: (colors: HostTerminalColors) => void): void;
43
50
  cursorPosition: Point;
44
51
  renderFrame(grid: Grid, cursorPosition: Point): void;
45
52
  getSize(): Size;
@@ -1,3 +1,4 @@
1
+ import { NO_HOST_COLORS } from "@tuidom/core/backend/iTerminalBackend";
1
2
  import { DEFAULT_COLOR } from "@tuidom/core/common/colorUtils";
2
3
  import { Point, Size } from "@tuidom/core/common/geometryPromitives";
3
4
  import { KeyInputParser } from "@tuidom/core/input/keyInputParser";
@@ -67,6 +68,15 @@ export class MockTerminalBackend {
67
68
  probeTerminalVersion(onResult) {
68
69
  onResult(this.terminalVersion);
69
70
  }
71
+ /**
72
+ * What {@link probeHostColors} reports. Default: the terminal reported nothing.
73
+ * Set it before the app probes.
74
+ */
75
+ hostColors = NO_HOST_COLORS;
76
+ /** Answers synchronously with {@link hostColors} — no terminal round-trip to wait for. */
77
+ probeHostColors(onResult) {
78
+ onResult(this.hostColors);
79
+ }
70
80
  cursorPosition = new Point(0, 0);
71
81
  renderFrame(grid, cursorPosition) {
72
82
  for (let y = 0; y < grid.height && y < this.size.height; y++) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tuidom/testing",
3
- "version": "0.6.1",
3
+ "version": "0.8.0",
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.6.1",
32
- "@tuidom/elements": "0.6.1"
31
+ "@tuidom/core": "0.8.0",
32
+ "@tuidom/elements": "0.8.0"
33
33
  }
34
34
  }