@gtkx/testing 0.4.0 → 0.4.3

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 CHANGED
@@ -57,7 +57,7 @@ const App = () => {
57
57
 
58
58
  return (
59
59
  <ApplicationWindow title="Counter" onCloseRequest={quit}>
60
- <Box orientation={Orientation.VERTICAL} spacing={12} margin={20}>
60
+ <Box orientation={Orientation.VERTICAL} spacing={12}>
61
61
  <Label.Root label={`Count: ${count}`} />
62
62
  <Button label="Increment" onClicked={() => setCount((c) => c + 1)} />
63
63
  </Box>
@@ -117,10 +117,6 @@ User events: `click`, `dblClick`, `type`, `clear`, `tab`, `selectOptions`
117
117
  | [gtk4-demo](examples/gtk4-demo) | Widget showcase |
118
118
  | [todo](examples/todo) | Todo app with tests |
119
119
 
120
- ```bash
121
- cd examples/gtk4-demo && pnpm dev
122
- ```
123
-
124
120
  ## Packages
125
121
 
126
122
  | Package | Description |
@@ -136,7 +132,7 @@ cd examples/gtk4-demo && pnpm dev
136
132
  ## Requirements
137
133
 
138
134
  - Node.js 20+
139
- - GTK4 (`gtk4-devel` on Fedora, `libgtk-4-dev` on Ubuntu)
135
+ - GTK4 Runtime (`gtk4` on Fedora, `libgtk-4-1` on Ubuntu)
140
136
  - Linux
141
137
 
142
138
  ## Contributing
package/dist/types.d.ts CHANGED
@@ -14,16 +14,16 @@ export type TextMatch = string | RegExp | TextMatchFunction;
14
14
  /**
15
15
  * Options for normalizing text before comparison.
16
16
  */
17
- export interface NormalizerOptions {
17
+ export type NormalizerOptions = {
18
18
  /** Whether to trim whitespace from text. Defaults to true. */
19
19
  trim?: boolean;
20
20
  /** Whether to collapse multiple whitespace into single spaces. Defaults to true. */
21
21
  collapseWhitespace?: boolean;
22
- }
22
+ };
23
23
  /**
24
24
  * Options for text matching in queries.
25
25
  */
26
- export interface TextMatchOptions {
26
+ export type TextMatchOptions = {
27
27
  /** Whether to match the entire string exactly. Defaults to true. */
28
28
  exact?: boolean;
29
29
  /**
@@ -37,11 +37,11 @@ export interface TextMatchOptions {
37
37
  collapseWhitespace?: boolean;
38
38
  /** Maximum time in milliseconds to wait for a match. */
39
39
  timeout?: number;
40
- }
40
+ };
41
41
  /**
42
42
  * Options for querying elements by their accessible role.
43
43
  */
44
- export interface ByRoleOptions extends TextMatchOptions {
44
+ export type ByRoleOptions = TextMatchOptions & {
45
45
  /** Filter by the element's accessible name. Supports string, RegExp, or function matcher. */
46
46
  name?: TextMatch;
47
47
  /** Filter checkboxes/switches by checked state. */
@@ -54,22 +54,22 @@ export interface ByRoleOptions extends TextMatchOptions {
54
54
  expanded?: boolean;
55
55
  /** Filter headings by their level (1-6). */
56
56
  level?: number;
57
- }
57
+ };
58
58
  /**
59
59
  * Options for waitFor and related async utilities.
60
60
  */
61
- export interface WaitForOptions {
61
+ export type WaitForOptions = {
62
62
  /** Maximum time in milliseconds to wait. Defaults to 1000ms. */
63
63
  timeout?: number;
64
64
  /** Interval in milliseconds between condition checks. Defaults to 50ms. */
65
65
  interval?: number;
66
66
  /** Custom error handler called when timeout is reached. */
67
67
  onTimeout?: (error: Error) => Error;
68
- }
68
+ };
69
69
  /**
70
70
  * Options for the render function.
71
71
  */
72
- export interface RenderOptions {
72
+ export type RenderOptions = {
73
73
  /**
74
74
  * Controls how the rendered element is wrapped.
75
75
  * - `true` (default): Wrap in ApplicationWindow
@@ -79,12 +79,12 @@ export interface RenderOptions {
79
79
  wrapper?: boolean | ComponentType<{
80
80
  children: ReactNode;
81
81
  }>;
82
- }
82
+ };
83
83
  /**
84
84
  * Query methods bound to a specific container. All queries return promises
85
85
  * that resolve when a matching element is found or reject on timeout.
86
86
  */
87
- export interface BoundQueries {
87
+ export type BoundQueries = {
88
88
  /** Find a single element by its accessible role. */
89
89
  findByRole: (role: AccessibleRole, options?: ByRoleOptions) => Promise<Gtk.Widget>;
90
90
  /** Find a single element by its associated label text. */
@@ -101,12 +101,12 @@ export interface BoundQueries {
101
101
  findAllByText: (text: TextMatch, options?: TextMatchOptions) => Promise<Gtk.Widget[]>;
102
102
  /** Find all elements with matching test ID. */
103
103
  findAllByTestId: (testId: TextMatch, options?: TextMatchOptions) => Promise<Gtk.Widget[]>;
104
- }
104
+ };
105
105
  /**
106
106
  * The result returned by the render function. Includes query methods
107
107
  * and utilities for interacting with the rendered component.
108
108
  */
109
- export interface RenderResult extends BoundQueries {
109
+ export type RenderResult = BoundQueries & {
110
110
  /** The GTK Application instance containing the rendered component. */
111
111
  container: Gtk.Application;
112
112
  /** Unmount the rendered component and clean up resources. */
@@ -115,4 +115,4 @@ export interface RenderResult extends BoundQueries {
115
115
  rerender: (element: ReactNode) => Promise<void>;
116
116
  /** Print the current widget tree to the console for debugging. */
117
117
  debug: () => void;
118
- }
118
+ };
@@ -2,10 +2,10 @@ import type * as Gtk from "@gtkx/ffi/gtk";
2
2
  /**
3
3
  * Options for the tab user event.
4
4
  */
5
- export interface TabOptions {
5
+ export type TabOptions = {
6
6
  /** If true, navigates backwards (Shift+Tab behavior). */
7
7
  shift?: boolean;
8
- }
8
+ };
9
9
  /**
10
10
  * Simulates user interactions with GTK widgets. Provides methods that mimic
11
11
  * real user behavior like clicking, typing, and clearing input fields.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gtkx/testing",
3
- "version": "0.4.0",
3
+ "version": "0.4.3",
4
4
  "description": "Testing utilities for GTKX applications",
5
5
  "keywords": [
6
6
  "gtk",
@@ -32,9 +32,9 @@
32
32
  "dist"
33
33
  ],
34
34
  "dependencies": {
35
- "@gtkx/ffi": "0.4.0",
36
- "@gtkx/native": "0.4.0",
37
- "@gtkx/react": "0.4.0"
35
+ "@gtkx/ffi": "0.4.3",
36
+ "@gtkx/native": "0.4.3",
37
+ "@gtkx/react": "0.4.3"
38
38
  },
39
39
  "scripts": {
40
40
  "build": "tsc -b && cp ../../README.md .",