@gtkx/testing 0.5.0 → 0.5.2
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 +5 -27
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -49,7 +49,7 @@ import {
|
|
|
49
49
|
Label,
|
|
50
50
|
quit,
|
|
51
51
|
} from "@gtkx/react";
|
|
52
|
-
import
|
|
52
|
+
import * as Gtk from "@gtkx/ffi/gtk";
|
|
53
53
|
import { useState } from "react";
|
|
54
54
|
|
|
55
55
|
const App = () => {
|
|
@@ -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}>
|
|
60
|
+
<Box orientation={Gtk.Orientation.VERTICAL} spacing={12}>
|
|
61
61
|
<Label.Root label={`Count: ${count}`} />
|
|
62
62
|
<Button label="Increment" onClicked={() => setCount((c) => c + 1)} />
|
|
63
63
|
</Box>
|
|
@@ -90,45 +90,23 @@ GTK also provides built-in classes like `suggested-action`, `destructive-action`
|
|
|
90
90
|
|
|
91
91
|
```tsx
|
|
92
92
|
import { cleanup, render, screen, userEvent } from "@gtkx/testing";
|
|
93
|
-
import
|
|
93
|
+
import * as Gtk from "@gtkx/ffi/gtk";
|
|
94
94
|
|
|
95
95
|
afterEach(() => cleanup());
|
|
96
96
|
|
|
97
97
|
test("increments count", async () => {
|
|
98
98
|
await render(<App />);
|
|
99
99
|
|
|
100
|
-
const button = await screen.findByRole(AccessibleRole.BUTTON, {
|
|
100
|
+
const button = await screen.findByRole(Gtk.AccessibleRole.BUTTON, {
|
|
101
101
|
name: "Increment",
|
|
102
102
|
});
|
|
103
|
+
|
|
103
104
|
await userEvent.click(button);
|
|
104
105
|
|
|
105
106
|
await screen.findByText("Count: 1");
|
|
106
107
|
});
|
|
107
108
|
```
|
|
108
109
|
|
|
109
|
-
Queries: `findByRole`, `findByText`, `findByLabelText`, `findByTestId`
|
|
110
|
-
|
|
111
|
-
User events: `click`, `dblClick`, `type`, `clear`, `tab`, `selectOptions`
|
|
112
|
-
|
|
113
|
-
## Examples
|
|
114
|
-
|
|
115
|
-
| Example | Description |
|
|
116
|
-
| ------------------------------- | ------------------- |
|
|
117
|
-
| [gtk4-demo](examples/gtk4-demo) | Widget showcase |
|
|
118
|
-
| [todo](examples/todo) | Todo app with tests |
|
|
119
|
-
|
|
120
|
-
## Packages
|
|
121
|
-
|
|
122
|
-
| Package | Description |
|
|
123
|
-
| --------------------------------- | ------------------------------------- |
|
|
124
|
-
| [@gtkx/cli](packages/cli) | CLI with HMR dev server |
|
|
125
|
-
| [@gtkx/react](packages/react) | React reconciler and JSX components |
|
|
126
|
-
| [@gtkx/ffi](packages/ffi) | TypeScript bindings for GTK4/GLib/GIO |
|
|
127
|
-
| [@gtkx/native](packages/native) | Rust native module (libffi bridge) |
|
|
128
|
-
| [@gtkx/css](packages/css) | CSS-in-JS styling |
|
|
129
|
-
| [@gtkx/testing](packages/testing) | Testing utilities |
|
|
130
|
-
| [@gtkx/gir](packages/gir) | GObject Introspection parser |
|
|
131
|
-
|
|
132
110
|
## Requirements
|
|
133
111
|
|
|
134
112
|
- Node.js 20+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gtkx/testing",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.2",
|
|
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/
|
|
36
|
-
"@gtkx/
|
|
37
|
-
"@gtkx/react": "0.5.
|
|
35
|
+
"@gtkx/ffi": "0.5.2",
|
|
36
|
+
"@gtkx/native": "0.5.2",
|
|
37
|
+
"@gtkx/react": "0.5.2"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
40
|
"build": "tsc -b && cp ../../README.md .",
|