@gtkx/testing 0.12.0 → 0.13.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.
package/README.md CHANGED
@@ -49,7 +49,7 @@ const App = () => {
49
49
  title="Counter"
50
50
  defaultWidth={300}
51
51
  defaultHeight={200}
52
- onCloseRequest={quit}
52
+ onClose={quit}
53
53
  >
54
54
  <GtkBox
55
55
  orientation={Gtk.Orientation.VERTICAL}
package/dist/render.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { discardAllBatches, start } from "@gtkx/ffi";
2
+ import { discardAllBatches, start, stop } from "@gtkx/ffi";
3
3
  import * as Gio from "@gtkx/ffi/gio";
4
4
  import { ApplicationContext, GtkApplicationWindow, reconciler } from "@gtkx/react";
5
5
  import { bindQueries } from "./bind-queries.js";
@@ -31,7 +31,7 @@ const ensureInitialized = () => {
31
31
  }
32
32
  return { app: application, container };
33
33
  };
34
- const DefaultWrapper = ({ children }) => (_jsx(GtkApplicationWindow, { children: children }));
34
+ const DefaultWrapper = ({ children }) => (_jsx(GtkApplicationWindow, { defaultWidth: 800, defaultHeight: 600, children: children }));
35
35
  const wrapElement = (element, wrapper = true) => {
36
36
  if (wrapper === false)
37
37
  return element;
@@ -113,3 +113,12 @@ export const cleanup = async () => {
113
113
  container = null;
114
114
  setScreenRoot(null);
115
115
  };
116
+ const handleSignal = () => {
117
+ try {
118
+ stop();
119
+ }
120
+ catch { }
121
+ process.exit(0);
122
+ };
123
+ process.on("SIGTERM", handleSignal);
124
+ process.on("SIGINT", handleSignal);
@@ -253,6 +253,9 @@ const keyboard = async (element, input) => {
253
253
  for (const action of actions) {
254
254
  const signalName = action.press ? "key-pressed" : "key-released";
255
255
  emitSignal(controller, signalName, { type: "int", value: action.keyval }, { type: "int", value: 0 }, { type: "int", value: 0 });
256
+ if (action.press && action.keyval === Gdk.KEY_Return && isEditable(element)) {
257
+ await fireEvent(element, "activate");
258
+ }
256
259
  }
257
260
  await tick();
258
261
  };
package/dist/wait-for.js CHANGED
@@ -76,7 +76,7 @@ export const waitForElementToBeRemoved = async (elementOrCallback, options) => {
76
76
  const { timeout = DEFAULT_TIMEOUT, interval = DEFAULT_INTERVAL, onTimeout } = options ?? {};
77
77
  const initialElement = getElement(elementOrCallback);
78
78
  if (initialElement === null || isElementRemoved(initialElement)) {
79
- throw new Error("Elements already removed: waitForElementToBeRemoved requires elements to be present initially");
79
+ throw new Error("Element already removed: waitForElementToBeRemoved requires the element to be present initially");
80
80
  }
81
81
  const startTime = Date.now();
82
82
  while (Date.now() - startTime < timeout) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gtkx/testing",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
4
  "description": "Testing utilities for GTKX applications",
5
5
  "keywords": [
6
6
  "gtkx",
@@ -36,14 +36,14 @@
36
36
  "dist"
37
37
  ],
38
38
  "dependencies": {
39
- "@gtkx/ffi": "0.12.0",
40
- "@gtkx/native": "0.12.0",
41
- "@gtkx/react": "0.12.0"
39
+ "@gtkx/ffi": "0.13.0",
40
+ "@gtkx/native": "0.13.0",
41
+ "@gtkx/react": "0.13.0"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@types/react-reconciler": "^0.32.3",
45
45
  "react-reconciler": "^0.33.0",
46
- "@gtkx/vitest": "0.12.0"
46
+ "@gtkx/vitest": "0.13.0"
47
47
  },
48
48
  "scripts": {
49
49
  "build": "tsc -b && cp ../../README.md .",