Skip to content

Commit 17b5c16

Browse files
committed
Remove window-element query from core
1 parent 957cde8 commit 17b5c16

File tree

1 file changed

+40
-10
lines changed

1 file changed

+40
-10
lines changed

Diff for: core/nut.js/lib/window.class.spec.ts

+40-10
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import {
77
WindowProviderInterface
88
} from "@nut-tree/provider-interfaces";
99
import { mockPartial } from "sneer";
10-
import { Region, RGBA, WindowElement, WindowElementDescription } from "@nut-tree/shared";
11-
import { pixelWithColor, windowElementDescribedBy } from "../index";
10+
import { Region, RGBA, WindowElement, WindowElementDescription, WindowElementQuery } from "@nut-tree/shared";
11+
import { pixelWithColor } from "../index";
1212
import { NoopLogProvider } from "./provider/log/noop-log-provider.class";
1313

1414
jest.setTimeout(50000);
@@ -103,12 +103,20 @@ describe("Window class", () => {
103103
});
104104
const mockWindowHandle = 123;
105105
const description: WindowElementDescription = {
106-
type: "test"
106+
type: "test",
107+
id: "foo"
108+
};
109+
const query: WindowElementQuery = {
110+
id: "test",
111+
type: "window-element",
112+
by: {
113+
description
114+
}
107115
};
108116
const SUT = new Window(providerRegistryMock, mockWindowHandle);
109117

110118
// WHEN
111-
await SUT.find(windowElementDescribedBy(description));
119+
await SUT.find(query);
112120

113121
// THEN
114122
expect(elementInspectorMock).toHaveBeenCalledTimes(1);
@@ -131,12 +139,20 @@ describe("Window class", () => {
131139
});
132140
const mockWindowHandle = 123;
133141
const description: WindowElementDescription = {
134-
type: "test"
142+
type: "test",
143+
id: "foo"
144+
};
145+
const query: WindowElementQuery = {
146+
id: "test",
147+
type: "window-element",
148+
by: {
149+
description
150+
}
135151
};
136152
const SUT = new Window(providerRegistryMock, mockWindowHandle);
137153

138154
// WHEN
139-
await SUT.findAll(windowElementDescribedBy(description));
155+
await SUT.findAll(query);
140156

141157
// THEN
142158
expect(elementInspectorMock).toHaveBeenCalledTimes(1);
@@ -240,9 +256,16 @@ describe("Window class", () => {
240256
});
241257
const mockWindowHandle = 123;
242258
const description: WindowElementDescription = {
243-
type: "test"
259+
type: "test",
260+
id: "foo"
261+
};
262+
const query: WindowElementQuery = {
263+
id: "test",
264+
type: "window-element",
265+
by: {
266+
description
267+
}
244268
};
245-
const query = windowElementDescribedBy(description);
246269
const SUT = new Window(providerRegistryMock, mockWindowHandle);
247270
SUT.on(query, hookMock);
248271
SUT.on(query, secondHookMock);
@@ -281,9 +304,16 @@ describe("Window class", () => {
281304
});
282305
const mockWindowHandle = 123;
283306
const description: WindowElementDescription = {
284-
type: "test"
307+
type: "test",
308+
id: "foo"
309+
};
310+
const query: WindowElementQuery = {
311+
id: "test",
312+
type: "window-element",
313+
by: {
314+
description
315+
}
285316
};
286-
const query = windowElementDescribedBy(description);
287317
const SUT = new Window(providerRegistryMock, mockWindowHandle);
288318
SUT.on(query, hookMock);
289319
SUT.on(query, secondHookMock);

0 commit comments

Comments
 (0)