@gtkx/testing 0.1.36 → 0.1.37

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/dist/index.d.ts CHANGED
@@ -2,7 +2,8 @@ export { fireEvent } from "./fire-event.js";
2
2
  export { findAllByLabelText, findAllByRole, findAllByTestId, findAllByText, findByLabelText, findByRole, findByTestId, findByText, } from "./queries.js";
3
3
  export { cleanup, render, teardown } from "./render.js";
4
4
  export { screen } from "./screen.js";
5
- export type { ByRoleOptions, RenderOptions, RenderResult, TextMatchOptions, WaitForOptions, } from "./types.js";
5
+ export type { BoundQueries, ByRoleOptions, RenderOptions, RenderResult, TextMatchOptions, WaitForOptions, } from "./types.js";
6
6
  export type { UserEventInstance, UserEventOptions } from "./user-event.js";
7
7
  export { userEvent } from "./user-event.js";
8
8
  export { waitFor, waitForElementToBeRemoved } from "./wait-for.js";
9
+ export { within } from "./within.js";
package/dist/index.js CHANGED
@@ -4,3 +4,4 @@ export { cleanup, render, teardown } from "./render.js";
4
4
  export { screen } from "./screen.js";
5
5
  export { userEvent } from "./user-event.js";
6
6
  export { waitFor, waitForElementToBeRemoved } from "./wait-for.js";
7
+ export { within } from "./within.js";
package/dist/types.d.ts CHANGED
@@ -23,8 +23,7 @@ export interface RenderOptions {
23
23
  children: ReactNode;
24
24
  }>;
25
25
  }
26
- export interface RenderResult {
27
- container: Gtk.Application;
26
+ export interface BoundQueries {
28
27
  findByRole: (role: AccessibleRole, options?: ByRoleOptions) => Promise<Gtk.Widget>;
29
28
  findByLabelText: (text: string | RegExp, options?: TextMatchOptions) => Promise<Gtk.Widget>;
30
29
  findByText: (text: string | RegExp, options?: TextMatchOptions) => Promise<Gtk.Widget>;
@@ -33,6 +32,9 @@ export interface RenderResult {
33
32
  findAllByLabelText: (text: string | RegExp, options?: TextMatchOptions) => Promise<Gtk.Widget[]>;
34
33
  findAllByText: (text: string | RegExp, options?: TextMatchOptions) => Promise<Gtk.Widget[]>;
35
34
  findAllByTestId: (testId: string | RegExp, options?: TextMatchOptions) => Promise<Gtk.Widget[]>;
35
+ }
36
+ export interface RenderResult extends BoundQueries {
37
+ container: Gtk.Application;
36
38
  unmount: () => Promise<void>;
37
39
  rerender: (element: ReactNode) => Promise<void>;
38
40
  debug: () => void;
@@ -0,0 +1,3 @@
1
+ import type * as Gtk from "@gtkx/ffi/gtk";
2
+ import type { BoundQueries } from "./types.js";
3
+ export declare const within: (container: Gtk.Widget) => BoundQueries;
package/dist/within.js ADDED
@@ -0,0 +1,11 @@
1
+ import * as queries from "./queries.js";
2
+ export const within = (container) => ({
3
+ findByRole: (role, options) => queries.findByRole(container, role, options),
4
+ findByLabelText: (text, options) => queries.findByLabelText(container, text, options),
5
+ findByText: (text, options) => queries.findByText(container, text, options),
6
+ findByTestId: (testId, options) => queries.findByTestId(container, testId, options),
7
+ findAllByRole: (role, options) => queries.findAllByRole(container, role, options),
8
+ findAllByLabelText: (text, options) => queries.findAllByLabelText(container, text, options),
9
+ findAllByText: (text, options) => queries.findAllByText(container, text, options),
10
+ findAllByTestId: (testId, options) => queries.findAllByTestId(container, testId, options),
11
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gtkx/testing",
3
- "version": "0.1.36",
3
+ "version": "0.1.37",
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/native": "0.1.36",
36
- "@gtkx/react": "0.1.36",
37
- "@gtkx/ffi": "0.1.36"
35
+ "@gtkx/ffi": "0.1.37",
36
+ "@gtkx/react": "0.1.37",
37
+ "@gtkx/native": "0.1.37"
38
38
  },
39
39
  "scripts": {
40
40
  "build": "tsc -b && cp ../../README.md .",