xmlui 0.10.14 → 0.10.16
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/lib/{index-779mp2Bm.mjs → index-D4RYJasT.mjs} +2952 -937
- package/dist/lib/index.css +1 -1
- package/dist/lib/{initMock-CAXdczCj.mjs → initMock-qzTZlH-6.mjs} +1 -1
- package/dist/lib/language-server-web-worker.mjs +1 -1
- package/dist/lib/language-server.mjs +1 -1
- package/dist/lib/{metadata-utils-D90qqMGc.mjs → metadata-utils-CtY0QcvH.mjs} +2 -1
- package/dist/lib/{server-common-lmBDLpUh.mjs → server-common-Cine5nRR.mjs} +1 -1
- package/dist/lib/xmlui-parser.d.ts +1 -1
- package/dist/lib/xmlui.d.ts +87 -11
- package/dist/lib/xmlui.mjs +72 -37
- package/dist/metadata/{collectedComponentMetadata-7DFXlw-J.mjs → collectedComponentMetadata-BQaefK3f.mjs} +3189 -1242
- package/dist/metadata/{initMock-AFWEftc6.mjs → initMock-Cz6QssI3.mjs} +1 -1
- package/dist/metadata/style.css +1 -1
- package/dist/metadata/xmlui-metadata.mjs +1 -1
- package/dist/metadata/xmlui-metadata.umd.js +3 -3
- package/dist/scripts/package.json +2 -3
- package/dist/scripts/src/components/Animation/AnimationNative.js +5 -1
- package/dist/scripts/src/components/AppState/AppState.js +32 -2
- package/dist/scripts/src/components/AppState/AppStateNative.js +27 -3
- package/dist/scripts/src/components/AutoComplete/AutoComplete.js +1 -5
- package/dist/scripts/src/components/AutoComplete/AutoCompleteContext.js +2 -0
- package/dist/scripts/src/components/AutoComplete/AutoCompleteNative.js +263 -82
- package/dist/scripts/src/components/Button/Button.js +5 -1
- package/dist/scripts/src/components/Charts/PieChart/PieChartNative.js +41 -2
- package/dist/scripts/src/components/DropdownMenu/DropdownMenuNative.js +7 -9
- package/dist/scripts/src/components/Form/FormNative.js +33 -25
- package/dist/scripts/src/components/FormItem/ItemWithLabel.js +3 -3
- package/dist/scripts/src/components/Icon/IconNative.js +18 -15
- package/dist/scripts/src/components/NavGroup/NavGroup.spec.js +182 -123
- package/dist/scripts/src/components/NavGroup/NavGroupNative.js +14 -6
- package/dist/scripts/src/components/NestedApp/AppWithCodeViewNative.js +1 -1
- package/dist/scripts/src/components/NumberBox/NumberBox.js +4 -4
- package/dist/scripts/src/components/NumberBox/NumberBox.spec.js +112 -423
- package/dist/scripts/src/components/NumberBox/NumberBoxNative.js +18 -4
- package/dist/scripts/src/components/Option/Option.js +3 -1
- package/dist/scripts/src/components/Select/HiddenOption.js +1 -1
- package/dist/scripts/src/components/SelectionStore/SelectionStoreNative.js +3 -1
- package/dist/scripts/src/components/Slider/Slider.spec.js +46 -13
- package/dist/scripts/src/components/Slider/SliderNative.js +19 -9
- package/dist/scripts/src/components/Table/Table.js +7 -1
- package/dist/scripts/src/components/Table/TableNative.js +4 -1
- package/dist/scripts/src/components/Table/useRowSelection.js +215 -1
- package/dist/scripts/src/components/TextBox/TextBox.js +1 -5
- package/dist/scripts/src/components/TextBox/TextBox.spec.js +368 -324
- package/dist/scripts/src/components/TextBox/TextBoxNative.js +10 -15
- package/dist/scripts/src/components/Theme/ThemeNative.js +2 -6
- package/dist/scripts/src/components/TimeInput/TimeInput.js +1 -5
- package/dist/scripts/src/components/TimeInput/TimeInputNative.js +2 -9
- package/dist/scripts/src/components/Tree/Tree-dynamic.spec.js +2894 -0
- package/dist/scripts/src/components/Tree/Tree.spec.js +2932 -0
- package/dist/scripts/src/components/Tree/TreeComponent.js +266 -10
- package/dist/scripts/src/components/Tree/TreeNative.js +1048 -23
- package/dist/scripts/src/components/Tree/testData.js +272 -0
- package/dist/scripts/src/components-core/ApiBoundComponent.js +38 -24
- package/dist/scripts/src/components-core/RestApiProxy.js +0 -1
- package/dist/scripts/src/components-core/behaviors/BehaviorContext.js +54 -0
- package/dist/scripts/src/components-core/behaviors/CoreBehaviors.js +81 -0
- package/dist/scripts/src/components-core/descriptorHelper.js +1 -0
- package/dist/scripts/src/components-core/parts.js +4 -1
- package/dist/scripts/src/components-core/rendering/AppRoot.js +2 -1
- package/dist/scripts/src/components-core/rendering/ComponentAdapter.js +32 -48
- package/dist/scripts/src/components-core/rendering/nodeUtils.js +6 -0
- package/dist/scripts/src/components-core/theming/layout-resolver.js +2 -0
- package/dist/scripts/src/components-core/utils/treeUtils.js +187 -12
- package/dist/scripts/src/index.js +38 -1
- package/dist/scripts/src/testing/ComponentDrivers.js +77 -31
- package/dist/scripts/src/testing/drivers/NumberBoxDriver.js +44 -0
- package/dist/scripts/src/testing/drivers/TextBoxDriver.js +20 -0
- package/dist/scripts/src/testing/drivers/TreeDriver.js +13 -0
- package/dist/scripts/src/testing/fixtures.js +40 -9
- package/dist/standalone/xmlui-standalone.es.d.ts +158 -15
- package/dist/standalone/xmlui-standalone.umd.js +36 -36
- package/package.json +2 -3
- package/dist/scripts/src/components/Animation/Animation.js +0 -50
|
@@ -28,46 +28,50 @@ fixtures_1.test.describe("Basic Functionality", () => {
|
|
|
28
28
|
yield initTestBed(`<NumberBox initialValue="123" />`);
|
|
29
29
|
yield (0, fixtures_1.expect)(page.getByRole("textbox")).toHaveValue("123");
|
|
30
30
|
}));
|
|
31
|
-
[
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
|
|
31
|
+
(0, fixtures_1.test)("initialValue ignores non-numeric string", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
32
|
+
yield initTestBed(`
|
|
33
|
+
<NumberBox initialValue="can't be this" />
|
|
34
|
+
`);
|
|
35
|
+
yield (0, fixtures_1.expect)(page.getByRole("textbox")).toHaveValue("");
|
|
36
|
+
}));
|
|
37
|
+
(0, fixtures_1.test)("initialValue accepts various types", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
38
|
+
yield initTestBed(`
|
|
39
|
+
<Stack>
|
|
40
|
+
<NumberBox testId="integer" initialValue="{1}" />
|
|
41
|
+
<NumberBox testId="float" initialValue="{1.2}" />
|
|
42
|
+
<NumberBox testId="undefined" initialValue="{undefined}" />
|
|
43
|
+
<NumberBox testId="null" initialValue="{null}" />
|
|
44
|
+
<NumberBox testId="empty-string" initialValue="" />
|
|
45
|
+
<NumberBox testId="string-integer" initialValue="1" />
|
|
46
|
+
<NumberBox testId="string-float" initialValue="1.2" />
|
|
47
|
+
</Stack>
|
|
48
|
+
`);
|
|
49
|
+
yield (0, fixtures_1.expect)(page.getByTestId("integer").getByRole("textbox")).toHaveValue("1");
|
|
50
|
+
yield (0, fixtures_1.expect)(page.getByTestId("float").getByRole("textbox")).toHaveValue("1.2");
|
|
51
|
+
yield (0, fixtures_1.expect)(page.getByTestId("undefined").getByRole("textbox")).toHaveValue("");
|
|
52
|
+
yield (0, fixtures_1.expect)(page.getByTestId("null").getByRole("textbox")).toHaveValue("");
|
|
53
|
+
yield (0, fixtures_1.expect)(page.getByTestId("empty-string").getByRole("textbox")).toHaveValue("");
|
|
54
|
+
yield (0, fixtures_1.expect)(page.getByTestId("string-integer").getByRole("textbox")).toHaveValue("1");
|
|
55
|
+
yield (0, fixtures_1.expect)(page.getByTestId("string-float").getByRole("textbox")).toHaveValue("1.2");
|
|
56
|
+
}));
|
|
45
57
|
// --- enabled prop
|
|
46
58
|
(0, fixtures_1.test)("enabled=false disables control", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
47
59
|
yield initTestBed(`<NumberBox enabled="false" />`);
|
|
48
60
|
yield (0, fixtures_1.expect)(page.getByRole("textbox")).toBeDisabled();
|
|
49
61
|
}));
|
|
50
|
-
(0, fixtures_1.test)("enabled=
|
|
51
|
-
yield initTestBed(`<NumberBox enabled="false" />`);
|
|
52
|
-
yield (0, fixtures_1.expect)(page.getByRole("textbox")).not.toBeEditable();
|
|
53
|
-
}));
|
|
54
|
-
(0, fixtures_1.test)("enabled=true disables control", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
62
|
+
(0, fixtures_1.test)("enabled=true enables control", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
55
63
|
yield initTestBed(`<NumberBox enabled="true" />`);
|
|
56
64
|
yield (0, fixtures_1.expect)(page.getByRole("textbox")).not.toBeDisabled();
|
|
57
65
|
}));
|
|
58
|
-
(0, fixtures_1.test)("
|
|
59
|
-
yield initTestBed(`<NumberBox enabled="true" />`);
|
|
60
|
-
yield (0, fixtures_1.expect)(page.getByRole("textbox")).toBeEditable();
|
|
61
|
-
}));
|
|
62
|
-
(0, fixtures_1.test)("disabled input field stops user interaction for spinbox", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
66
|
+
(0, fixtures_1.test)("disabled input field stops user interaction for spinbox", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createNumberBoxDriver, }) {
|
|
63
67
|
yield initTestBed(`<NumberBox enabled="false" initialValue="5" />`);
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
const driver = yield createNumberBoxDriver();
|
|
69
|
+
yield driver.increment();
|
|
70
|
+
yield (0, fixtures_1.expect)(driver.input).toHaveValue("5");
|
|
71
|
+
yield (0, fixtures_1.expect)(driver.spinnerUp).toBeDisabled();
|
|
72
|
+
yield driver.decrement();
|
|
73
|
+
yield (0, fixtures_1.expect)(driver.input).toHaveValue("5");
|
|
74
|
+
yield (0, fixtures_1.expect)(driver.spinnerDown).toBeDisabled();
|
|
71
75
|
}));
|
|
72
76
|
// --- readOnly prop
|
|
73
77
|
(0, fixtures_1.test)("readOnly adds readonly attribute", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
@@ -87,16 +91,6 @@ fixtures_1.test.describe("Basic Functionality", () => {
|
|
|
87
91
|
yield input.focus();
|
|
88
92
|
yield (0, fixtures_1.expect)(input).toBeFocused();
|
|
89
93
|
}));
|
|
90
|
-
(0, fixtures_1.test)("readOnly disables the spinbox", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
91
|
-
yield initTestBed(`<NumberBox readOnly="true" initialValue="5" />`);
|
|
92
|
-
// Try to find and click spinbox buttons
|
|
93
|
-
const spinButtons = page.locator("button");
|
|
94
|
-
const firstSpinButton = spinButtons.first();
|
|
95
|
-
if (yield firstSpinButton.isEnabled()) {
|
|
96
|
-
yield firstSpinButton.click();
|
|
97
|
-
yield (0, fixtures_1.expect)(page.getByRole("textbox")).toHaveValue("5"); // Should not change
|
|
98
|
-
}
|
|
99
|
-
}));
|
|
100
94
|
// --- required prop
|
|
101
95
|
(0, fixtures_1.test)("required prop adds required attribute", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
102
96
|
yield initTestBed(`<NumberBox required="true" />`);
|
|
@@ -107,13 +101,10 @@ fixtures_1.test.describe("Basic Functionality", () => {
|
|
|
107
101
|
yield (0, fixtures_1.expect)(page.getByText("test")).toContainText("*");
|
|
108
102
|
}));
|
|
109
103
|
// --- autoFocus prop
|
|
110
|
-
(0, fixtures_1.test)("autoFocus focuses input on mount", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed,
|
|
104
|
+
(0, fixtures_1.test)("autoFocus focuses input on mount", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createNumberBoxDriver }) {
|
|
111
105
|
yield initTestBed(`<NumberBox autoFocus="true" />`);
|
|
112
|
-
yield (
|
|
113
|
-
|
|
114
|
-
(0, fixtures_1.test)("autoFocus focuses input on mount with label", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
115
|
-
yield initTestBed(`<NumberBox autoFocus="true" label="Auto-focused input" />`);
|
|
116
|
-
yield (0, fixtures_1.expect)(page.getByLabel("Auto-focused input")).toBeFocused();
|
|
106
|
+
const driver = yield createNumberBoxDriver();
|
|
107
|
+
yield (0, fixtures_1.expect)(driver.input).toBeFocused();
|
|
117
108
|
}));
|
|
118
109
|
// --- placeholder prop
|
|
119
110
|
(0, fixtures_1.test)("placeholder shows when input is empty", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
@@ -122,8 +113,7 @@ fixtures_1.test.describe("Basic Functionality", () => {
|
|
|
122
113
|
}));
|
|
123
114
|
(0, fixtures_1.test)("placeholder does not appear if input is filled", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
124
115
|
yield initTestBed(`<NumberBox placeholder="placeholder text" initialValue="123" />`);
|
|
125
|
-
yield (0, fixtures_1.expect)(page.
|
|
126
|
-
yield (0, fixtures_1.expect)(page.getByRole("textbox", { name: "placeholder text" })).toBeVisible();
|
|
116
|
+
yield (0, fixtures_1.expect)(page.getByText("placeholder text")).not.toBeVisible();
|
|
127
117
|
}));
|
|
128
118
|
// --- maxLength prop
|
|
129
119
|
(0, fixtures_1.test)("maxLength limits input length", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
@@ -165,37 +155,23 @@ fixtures_1.test.describe("Basic Functionality", () => {
|
|
|
165
155
|
(0, fixtures_1.expect)(spinButtonCount).toBe(0);
|
|
166
156
|
}));
|
|
167
157
|
// --- step prop with spinbox
|
|
168
|
-
(0, fixtures_1.test)("clicking spinbox up-arrow adds step value", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed,
|
|
169
|
-
yield initTestBed(`<NumberBox initialValue="5" step="
|
|
170
|
-
const
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
yield
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
yield (0, fixtures_1.expect)(page.getByRole("textbox")).toHaveValue("4");
|
|
182
|
-
}
|
|
183
|
-
}));
|
|
184
|
-
(0, fixtures_1.test)("custom step value applies correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
185
|
-
yield initTestBed(`<NumberBox initialValue="10" step="5" />`);
|
|
186
|
-
const incrementButton = page.locator("button").first();
|
|
187
|
-
if (yield incrementButton.isVisible()) {
|
|
188
|
-
yield incrementButton.click();
|
|
189
|
-
yield (0, fixtures_1.expect)(page.getByRole("textbox")).toHaveValue("15");
|
|
190
|
-
}
|
|
191
|
-
}));
|
|
192
|
-
(0, fixtures_1.test)("float type step value is ignored", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
158
|
+
(0, fixtures_1.test)("clicking spinbox up-arrow adds step value", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createNumberBoxDriver, }) {
|
|
159
|
+
yield initTestBed(`<NumberBox initialValue="5" step="2" />`);
|
|
160
|
+
const driver = yield createNumberBoxDriver();
|
|
161
|
+
yield driver.increment();
|
|
162
|
+
yield (0, fixtures_1.expect)(driver.input).toHaveValue("7");
|
|
163
|
+
}));
|
|
164
|
+
(0, fixtures_1.test)("clicking spinbox down-arrow subtracts step value", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createNumberBoxDriver, }) {
|
|
165
|
+
yield initTestBed(`<NumberBox initialValue="5" step="2" />`);
|
|
166
|
+
const driver = yield createNumberBoxDriver();
|
|
167
|
+
yield driver.decrement();
|
|
168
|
+
yield (0, fixtures_1.expect)(driver.input).toHaveValue("3");
|
|
169
|
+
}));
|
|
170
|
+
(0, fixtures_1.test)("invalid step values use default step", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createNumberBoxDriver }) {
|
|
193
171
|
yield initTestBed(`<NumberBox initialValue="10" step="3.5" />`);
|
|
194
|
-
const
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
yield (0, fixtures_1.expect)(page.getByRole("textbox")).toHaveValue("11");
|
|
198
|
-
}
|
|
172
|
+
const driver = yield createNumberBoxDriver();
|
|
173
|
+
yield driver.increment();
|
|
174
|
+
yield (0, fixtures_1.expect)(driver.input).toHaveValue("11");
|
|
199
175
|
}));
|
|
200
176
|
// --- Arrow key navigation
|
|
201
177
|
(0, fixtures_1.test)("pressing up arrow adds step value", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
@@ -221,50 +197,44 @@ fixtures_1.test.describe("Basic Functionality", () => {
|
|
|
221
197
|
yield (0, fixtures_1.expect)(input).not.toHaveValue("123.45");
|
|
222
198
|
}));
|
|
223
199
|
// --- zeroOrPositive prop
|
|
224
|
-
(0, fixtures_1.test)("zeroOrPositive=true prevents negative values", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed,
|
|
225
|
-
yield initTestBed(`<NumberBox zeroOrPositive="true" initialValue="
|
|
226
|
-
const
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
yield decrementButton.click();
|
|
232
|
-
}
|
|
233
|
-
// Should not go below 0
|
|
234
|
-
const value = yield input.inputValue();
|
|
235
|
-
(0, fixtures_1.expect)(parseInt(value) || 0).toBeGreaterThanOrEqual(0);
|
|
236
|
-
}
|
|
200
|
+
(0, fixtures_1.test)("zeroOrPositive=true prevents negative values", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createNumberBoxDriver, }) {
|
|
201
|
+
yield initTestBed(`<NumberBox zeroOrPositive="true" initialValue="1" />`);
|
|
202
|
+
const driver = yield createNumberBoxDriver();
|
|
203
|
+
yield driver.decrement();
|
|
204
|
+
(0, fixtures_1.expect)(driver.input).toHaveValue("0");
|
|
205
|
+
yield driver.decrement();
|
|
206
|
+
(0, fixtures_1.expect)(driver.input).toHaveValue("0");
|
|
237
207
|
}));
|
|
238
208
|
// --- Range validation (min/max)
|
|
239
|
-
(0, fixtures_1.test)("minValue prevents values below minimum", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed,
|
|
240
|
-
yield initTestBed(`<NumberBox minValue="10" initialValue="
|
|
241
|
-
const
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
}));
|
|
254
|
-
(0, fixtures_1.test)("maxValue prevents values above maximum", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed,
|
|
255
|
-
yield initTestBed(`<NumberBox maxValue="
|
|
256
|
-
const
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
209
|
+
(0, fixtures_1.test)("minValue prevents values below minimum spinner button", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createNumberBoxDriver, }) {
|
|
210
|
+
yield initTestBed(`<NumberBox minValue="10" initialValue="11" />`);
|
|
211
|
+
const driver = yield createNumberBoxDriver();
|
|
212
|
+
yield driver.decrement();
|
|
213
|
+
yield (0, fixtures_1.expect)(driver.input).toHaveValue("10");
|
|
214
|
+
yield driver.decrement();
|
|
215
|
+
yield (0, fixtures_1.expect)(driver.input).toHaveValue("10");
|
|
216
|
+
}));
|
|
217
|
+
(0, fixtures_1.test)("minValue prevents typing values below minimum", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
218
|
+
yield initTestBed(`<NumberBox minValue="10" initialValue="11" />`);
|
|
219
|
+
const textbox = page.getByRole("textbox");
|
|
220
|
+
yield textbox.fill("2");
|
|
221
|
+
yield textbox.blur();
|
|
222
|
+
yield (0, fixtures_1.expect)(textbox).toHaveValue("10");
|
|
223
|
+
}));
|
|
224
|
+
(0, fixtures_1.test)("maxValue prevents values above maximum spinner button", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createNumberBoxDriver, }) {
|
|
225
|
+
yield initTestBed(`<NumberBox maxValue="11" initialValue="10" />`);
|
|
226
|
+
const driver = yield createNumberBoxDriver();
|
|
227
|
+
yield driver.increment();
|
|
228
|
+
yield (0, fixtures_1.expect)(driver.input).toHaveValue("11");
|
|
229
|
+
yield driver.increment();
|
|
230
|
+
yield (0, fixtures_1.expect)(driver.input).toHaveValue("11");
|
|
231
|
+
}));
|
|
232
|
+
(0, fixtures_1.test)("maxValue prevents typing values above maximum", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
233
|
+
yield initTestBed(`<NumberBox maxValue="11" initialValue="10" />`);
|
|
234
|
+
const textbox = page.getByRole("textbox");
|
|
235
|
+
yield textbox.fill("200");
|
|
236
|
+
yield textbox.blur();
|
|
237
|
+
yield (0, fixtures_1.expect)(textbox).toHaveValue("11");
|
|
268
238
|
}));
|
|
269
239
|
});
|
|
270
240
|
// =============================================================================
|
|
@@ -273,11 +243,8 @@ fixtures_1.test.describe("Basic Functionality", () => {
|
|
|
273
243
|
fixtures_1.test.describe("Accessibility", () => {
|
|
274
244
|
(0, fixtures_1.test)("has correct role", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
275
245
|
yield initTestBed(`<NumberBox testId="input" hasSpinBox="true" />`);
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
const button = spinButtons.nth(i);
|
|
279
|
-
yield (0, fixtures_1.expect)(button).toHaveAttribute("role", "spinbutton");
|
|
280
|
-
}
|
|
246
|
+
yield (0, fixtures_1.expect)(page.getByRole("spinbutton")).toHaveCount(2);
|
|
247
|
+
yield (0, fixtures_1.expect)(page.getByRole("textbox")).toBeVisible();
|
|
281
248
|
}));
|
|
282
249
|
(0, fixtures_1.test)("component supports keyboard navigation", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
283
250
|
yield initTestBed(`<NumberBox label="Amount" />`);
|
|
@@ -288,22 +255,6 @@ fixtures_1.test.describe("Accessibility", () => {
|
|
|
288
255
|
yield initTestBed(`<NumberBox required="true" label="Required field" />`);
|
|
289
256
|
yield (0, fixtures_1.expect)(page.getByRole("textbox")).toHaveAttribute("required");
|
|
290
257
|
}));
|
|
291
|
-
(0, fixtures_1.test)("disabled component has proper attribute", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
292
|
-
yield initTestBed(`<NumberBox enabled="false" />`);
|
|
293
|
-
yield (0, fixtures_1.expect)(page.getByRole("textbox")).toBeDisabled();
|
|
294
|
-
}));
|
|
295
|
-
(0, fixtures_1.test)("readOnly has proper ARIA attributes", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
296
|
-
yield initTestBed(`<NumberBox readOnly="true" />`);
|
|
297
|
-
yield (0, fixtures_1.expect)(page.getByRole("textbox")).toHaveAttribute("readonly");
|
|
298
|
-
}));
|
|
299
|
-
(0, fixtures_1.test)("spinbox buttons are accessible when present", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
300
|
-
yield initTestBed(`<NumberBox />`);
|
|
301
|
-
const spinButtons = page.locator("button");
|
|
302
|
-
for (let i = 0; i < (yield spinButtons.count()); i++) {
|
|
303
|
-
const button = spinButtons.nth(i);
|
|
304
|
-
yield (0, fixtures_1.expect)(button).toHaveAttribute("role", "spinbutton");
|
|
305
|
-
}
|
|
306
|
-
}));
|
|
307
258
|
});
|
|
308
259
|
// =============================================================================
|
|
309
260
|
// LABEL POSITIONING TESTS
|
|
@@ -386,27 +337,11 @@ fixtures_1.test.describe("Event Handling", () => {
|
|
|
386
337
|
yield page.getByRole("textbox").fill("123");
|
|
387
338
|
yield fixtures_1.expect.poll(testStateDriver.testState).toBe("123");
|
|
388
339
|
}));
|
|
389
|
-
(0, fixtures_1.test)("onDidChange is called on input change", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
390
|
-
const { testStateDriver } = yield initTestBed(`<NumberBox onDidChange="testState = 'test'" />`);
|
|
391
|
-
yield page.getByRole("textbox").fill("1");
|
|
392
|
-
yield fixtures_1.expect.poll(testStateDriver.testState).toBe("test");
|
|
393
|
-
}));
|
|
394
|
-
(0, fixtures_1.test)("onDidChange function changes are properly reflected", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
395
|
-
const { testStateDriver } = yield initTestBed(`<NumberBox onDidChange="arg => testState = arg" />`);
|
|
396
|
-
yield page.getByRole("textbox").fill("123");
|
|
397
|
-
yield fixtures_1.expect.poll(testStateDriver.testState).toBe("123");
|
|
398
|
-
}));
|
|
399
340
|
(0, fixtures_1.test)("gotFocus event fires on focus", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
400
341
|
const { testStateDriver } = yield initTestBed(`<NumberBox onGotFocus="testState = 'focused'" />`);
|
|
401
342
|
yield page.getByRole("textbox").focus();
|
|
402
343
|
yield fixtures_1.expect.poll(testStateDriver.testState).toBe("focused");
|
|
403
344
|
}));
|
|
404
|
-
(0, fixtures_1.test)("gotFocus event fires on focusing the field", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
405
|
-
const { testStateDriver } = yield initTestBed(`<NumberBox onGotFocus="testState = true" />`);
|
|
406
|
-
yield page.getByRole("textbox").focus();
|
|
407
|
-
yield (0, fixtures_1.expect)(page.getByRole("textbox")).toBeFocused();
|
|
408
|
-
yield fixtures_1.expect.poll(testStateDriver.testState).toEqual(true);
|
|
409
|
-
}));
|
|
410
345
|
(0, fixtures_1.test)("lostFocus event fires on blur", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
411
346
|
const { testStateDriver } = yield initTestBed(`<NumberBox onLostFocus="testState = 'blurred'" />`);
|
|
412
347
|
const input = page.getByRole("textbox");
|
|
@@ -414,14 +349,6 @@ fixtures_1.test.describe("Event Handling", () => {
|
|
|
414
349
|
yield input.blur();
|
|
415
350
|
yield fixtures_1.expect.poll(testStateDriver.testState).toBe("blurred");
|
|
416
351
|
}));
|
|
417
|
-
(0, fixtures_1.test)("lostFocus event fires when field is blurred", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
418
|
-
const { testStateDriver } = yield initTestBed(`<NumberBox onLostFocus="testState = true" />`);
|
|
419
|
-
const input = page.getByRole("textbox");
|
|
420
|
-
yield input.focus();
|
|
421
|
-
yield input.blur();
|
|
422
|
-
yield (0, fixtures_1.expect)(input).not.toBeFocused();
|
|
423
|
-
yield fixtures_1.expect.poll(testStateDriver.testState).toEqual(true);
|
|
424
|
-
}));
|
|
425
352
|
(0, fixtures_1.test)("events do not fire when component is disabled", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
426
353
|
const { testStateDriver } = yield initTestBed(`
|
|
427
354
|
<NumberBox enabled="false" onDidChange="testState = 'changed'" onGotFocus="testState = 'focused'" />
|
|
@@ -457,15 +384,6 @@ fixtures_1.test.describe("API", () => {
|
|
|
457
384
|
yield page.getByRole("button", { name: "test" }).click();
|
|
458
385
|
yield fixtures_1.expect.poll(testStateDriver.testState).toBe("456");
|
|
459
386
|
}));
|
|
460
|
-
(0, fixtures_1.test)("value returns current input value", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
461
|
-
const { testStateDriver } = yield initTestBed(`
|
|
462
|
-
<Fragment>
|
|
463
|
-
<NumberBox id="numberbox" initialValue="123" />
|
|
464
|
-
<Button label="test" onClick="testState = numberbox.value" />
|
|
465
|
-
</Fragment>`);
|
|
466
|
-
yield page.getByRole("button", { name: "test" }).click();
|
|
467
|
-
yield fixtures_1.expect.poll(testStateDriver.testState).toBe(123);
|
|
468
|
-
}));
|
|
469
387
|
(0, fixtures_1.test)("setValue API updates state", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
470
388
|
yield initTestBed(`
|
|
471
389
|
<Fragment>
|
|
@@ -476,15 +394,6 @@ fixtures_1.test.describe("API", () => {
|
|
|
476
394
|
yield page.getByRole("button", { name: "test" }).click();
|
|
477
395
|
yield (0, fixtures_1.expect)(page.getByRole("textbox")).toHaveValue("789");
|
|
478
396
|
}));
|
|
479
|
-
(0, fixtures_1.test)("setValue updates input value", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
480
|
-
yield initTestBed(`
|
|
481
|
-
<Fragment>
|
|
482
|
-
<NumberBox id="numberbox" />
|
|
483
|
-
<Button label="test" onClick="numberbox.setValue(456)" />
|
|
484
|
-
</Fragment>`);
|
|
485
|
-
yield page.getByRole("button", { name: "test" }).click();
|
|
486
|
-
yield (0, fixtures_1.expect)(page.getByRole("textbox")).toHaveValue("456");
|
|
487
|
-
}));
|
|
488
397
|
(0, fixtures_1.test)("setValue API triggers events", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
489
398
|
const { testStateDriver } = yield initTestBed(`
|
|
490
399
|
<Fragment>
|
|
@@ -505,15 +414,6 @@ fixtures_1.test.describe("API", () => {
|
|
|
505
414
|
yield page.getByRole("button", { name: "test" }).click();
|
|
506
415
|
yield (0, fixtures_1.expect)(page.getByRole("textbox")).toBeFocused();
|
|
507
416
|
}));
|
|
508
|
-
(0, fixtures_1.test)("focus() focuses the field", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
509
|
-
yield initTestBed(`
|
|
510
|
-
<Fragment>
|
|
511
|
-
<NumberBox id="numberbox" />
|
|
512
|
-
<Button label="test" onClick="numberbox.focus()" />
|
|
513
|
-
</Fragment>`);
|
|
514
|
-
yield page.getByRole("button", { name: "test" }).click();
|
|
515
|
-
yield (0, fixtures_1.expect)(page.getByRole("textbox")).toBeFocused();
|
|
516
|
-
}));
|
|
517
417
|
(0, fixtures_1.test)("focus API does nothing when component is disabled", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
518
418
|
yield initTestBed(`
|
|
519
419
|
<Fragment>
|
|
@@ -801,26 +701,12 @@ fixtures_1.test.describe("Theme Variables", () => {
|
|
|
801
701
|
});
|
|
802
702
|
yield (0, fixtures_1.expect)(page.getByTestId("input")).toHaveCSS("background-color", "rgb(255, 240, 240)");
|
|
803
703
|
}));
|
|
804
|
-
// Warning variant theme variables
|
|
805
|
-
(0, fixtures_1.test)("warning variant borderColor applies correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
806
|
-
yield initTestBed(`<NumberBox testId="input" validationStatus="warning" />`, {
|
|
807
|
-
testThemeVars: { "borderColor-NumberBox-warning": "rgb(255, 193, 7)" },
|
|
808
|
-
});
|
|
809
|
-
yield (0, fixtures_1.expect)(page.getByTestId("input")).toHaveCSS("border-color", "rgb(255, 193, 7)");
|
|
810
|
-
}));
|
|
811
704
|
(0, fixtures_1.test)("warning variant textColor applies correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
812
705
|
yield initTestBed(`<NumberBox testId="input" validationStatus="warning" />`, {
|
|
813
706
|
testThemeVars: { "textColor-NumberBox-warning": "rgb(133, 100, 4)" },
|
|
814
707
|
});
|
|
815
708
|
yield (0, fixtures_1.expect)(page.getByTestId("input")).toHaveCSS("color", "rgb(133, 100, 4)");
|
|
816
709
|
}));
|
|
817
|
-
// Success variant theme variables
|
|
818
|
-
(0, fixtures_1.test)("success variant borderColor applies correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
819
|
-
yield initTestBed(`<NumberBox testId="input" validationStatus="valid" />`, {
|
|
820
|
-
testThemeVars: { "borderColor-NumberBox-success": "rgb(40, 167, 69)" },
|
|
821
|
-
});
|
|
822
|
-
yield (0, fixtures_1.expect)(page.getByTestId("input")).toHaveCSS("border-color", "rgb(40, 167, 69)");
|
|
823
|
-
}));
|
|
824
710
|
(0, fixtures_1.test)("success variant backgroundColor applies correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
825
711
|
yield initTestBed(`<NumberBox testId="input" validationStatus="valid" />`, {
|
|
826
712
|
testThemeVars: { "backgroundColor-NumberBox-success": "rgb(240, 255, 240)" },
|
|
@@ -868,14 +754,8 @@ fixtures_1.test.describe("Validation", () => {
|
|
|
868
754
|
yield initTestBed(`<NumberBox testId="input" validationStatus="invalid-status" />`, {
|
|
869
755
|
testThemeVars: {
|
|
870
756
|
"borderColor-NumberBox": "rgb(0, 0, 0)",
|
|
871
|
-
"borderColor-NumberBox-error": "rgb(255, 0, 0)",
|
|
872
|
-
"borderColor-NumberBox-warning": "rgb(255, 165, 0)",
|
|
873
|
-
"borderColor-NumberBox-success": "rgb(0, 255, 0)",
|
|
874
757
|
},
|
|
875
758
|
});
|
|
876
|
-
yield (0, fixtures_1.expect)(page.getByTestId("input")).not.toHaveCSS("border-color", "rgb(255, 0, 0)");
|
|
877
|
-
yield (0, fixtures_1.expect)(page.getByTestId("input")).not.toHaveCSS("border-color", "rgb(255, 165, 0)");
|
|
878
|
-
yield (0, fixtures_1.expect)(page.getByTestId("input")).not.toHaveCSS("border-color", "rgb(0, 255, 0)");
|
|
879
759
|
yield (0, fixtures_1.expect)(page.getByTestId("input")).toHaveCSS("border-color", "rgb(0, 0, 0)");
|
|
880
760
|
}));
|
|
881
761
|
});
|
|
@@ -895,156 +775,6 @@ fixtures_1.test.describe("Other Edge Cases", () => {
|
|
|
895
775
|
yield initTestBed(`<NumberBox initialValue="{true}" />`);
|
|
896
776
|
yield (0, fixtures_1.expect)(page.getByRole("textbox")).toHaveValue("");
|
|
897
777
|
}));
|
|
898
|
-
(0, fixtures_1.test)("handles if initialValue is a string", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
899
|
-
yield initTestBed(`<NumberBox initialValue="asdasd" />`);
|
|
900
|
-
yield (0, fixtures_1.expect)(page.getByRole("textbox")).toHaveValue("asdasd");
|
|
901
|
-
}));
|
|
902
|
-
(0, fixtures_1.test)("if initialValue is too large, handles gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
903
|
-
yield initTestBed(`<NumberBox initialValue="100000000000000000000000000000000000" />`);
|
|
904
|
-
const input = page.getByRole("textbox");
|
|
905
|
-
// Should either clamp to max value or handle the large number appropriately
|
|
906
|
-
yield (0, fixtures_1.expect)(input).toBeVisible();
|
|
907
|
-
}));
|
|
908
|
-
(0, fixtures_1.test)("if initialValue is too small, handles gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
909
|
-
yield initTestBed(`<NumberBox initialValue="-100000000000000000000000000000000000" />`);
|
|
910
|
-
const input = page.getByRole("textbox");
|
|
911
|
-
// Should either clamp to min value or handle the small number appropriately
|
|
912
|
-
yield (0, fixtures_1.expect)(input).toBeVisible();
|
|
913
|
-
}));
|
|
914
|
-
(0, fixtures_1.test)("focuses component if autoFocus is set", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
915
|
-
yield initTestBed(`<NumberBox autoFocus="{true}" />`);
|
|
916
|
-
yield (0, fixtures_1.expect)(page.getByRole("textbox")).toBeFocused();
|
|
917
|
-
}));
|
|
918
|
-
(0, fixtures_1.test)("readOnly lets user copy from input field", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
919
|
-
yield initTestBed(`<NumberBox initialValue="123" readOnly="{true}" />`);
|
|
920
|
-
const input = page.getByRole("textbox");
|
|
921
|
-
yield (0, fixtures_1.expect)(input).toHaveValue("123");
|
|
922
|
-
yield input.focus();
|
|
923
|
-
yield (0, fixtures_1.expect)(input).toBeFocused();
|
|
924
|
-
}));
|
|
925
|
-
// Range and constraint tests with edge cases
|
|
926
|
-
(0, fixtures_1.test)("maxLength caps the length of the input", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
927
|
-
yield initTestBed(`<NumberBox maxLength="3" />`);
|
|
928
|
-
const input = page.getByRole("textbox");
|
|
929
|
-
yield input.fill("12345");
|
|
930
|
-
yield (0, fixtures_1.expect)(input).toHaveValue("123");
|
|
931
|
-
}));
|
|
932
|
-
(0, fixtures_1.test)("integersOnly limits input to integers", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
933
|
-
yield initTestBed(`<NumberBox integersOnly="true" />`);
|
|
934
|
-
const input = page.getByRole("textbox");
|
|
935
|
-
yield input.fill("123.45");
|
|
936
|
-
// Should not contain decimal
|
|
937
|
-
yield (0, fixtures_1.expect)(input).not.toHaveValue("123.45");
|
|
938
|
-
}));
|
|
939
|
-
(0, fixtures_1.test)("zeroOrPositive limits input to non-negative numbers and zero", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, }) {
|
|
940
|
-
yield initTestBed(`<NumberBox zeroOrPositive="true" initialValue="" />`);
|
|
941
|
-
yield page.getByRole("textbox").pressSequentially("-5");
|
|
942
|
-
const value = yield page.getByRole("textbox").inputValue();
|
|
943
|
-
(0, fixtures_1.expect)(parseInt(value) || 0).toBe(5);
|
|
944
|
-
}));
|
|
945
|
-
(0, fixtures_1.test)("using spinbox with zeroOrPositive limits input to non-negative numbers and zero", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, }) {
|
|
946
|
-
yield initTestBed(`<NumberBox zeroOrPositive="true" initialValue="5" />`);
|
|
947
|
-
// Try to decrement below zero using spinbox
|
|
948
|
-
const decrementButton = page
|
|
949
|
-
.locator("button")
|
|
950
|
-
.filter({ hasText: /decrement|down|\-/ })
|
|
951
|
-
.first();
|
|
952
|
-
if (yield decrementButton.isVisible()) {
|
|
953
|
-
for (let i = 0; i < 10; i++) {
|
|
954
|
-
yield decrementButton.click();
|
|
955
|
-
}
|
|
956
|
-
}
|
|
957
|
-
const value = yield page.getByRole("textbox").inputValue();
|
|
958
|
-
(0, fixtures_1.expect)(parseInt(value) || 0).toBeGreaterThanOrEqual(0);
|
|
959
|
-
}));
|
|
960
|
-
(0, fixtures_1.test)("minValue limits input to numbers greater than or equal to minValue", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, }) {
|
|
961
|
-
yield initTestBed(`<NumberBox minValue="10" initialValue="15" />`);
|
|
962
|
-
// Try to decrement below minimum
|
|
963
|
-
const decrementButton = page
|
|
964
|
-
.locator("button")
|
|
965
|
-
.filter({ hasText: /decrement|down|\-/ })
|
|
966
|
-
.first();
|
|
967
|
-
if (yield decrementButton.isVisible()) {
|
|
968
|
-
for (let i = 0; i < 10; i++) {
|
|
969
|
-
yield decrementButton.click();
|
|
970
|
-
}
|
|
971
|
-
}
|
|
972
|
-
const value = yield page.getByRole("textbox").inputValue();
|
|
973
|
-
(0, fixtures_1.expect)(parseInt(value) || 0).toBeGreaterThanOrEqual(10);
|
|
974
|
-
}));
|
|
975
|
-
(0, fixtures_1.test)("maxValue limits input to numbers less than or equal to maxValue", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, }) {
|
|
976
|
-
yield initTestBed(`<NumberBox maxValue="20" initialValue="15" />`);
|
|
977
|
-
// Try to increment above maximum
|
|
978
|
-
const incrementButton = page
|
|
979
|
-
.locator("button")
|
|
980
|
-
.filter({ hasText: /increment|up|\+/ })
|
|
981
|
-
.first();
|
|
982
|
-
if (yield incrementButton.isVisible()) {
|
|
983
|
-
for (let i = 0; i < 10; i++) {
|
|
984
|
-
yield incrementButton.click();
|
|
985
|
-
}
|
|
986
|
-
}
|
|
987
|
-
const value = yield page.getByRole("textbox").inputValue();
|
|
988
|
-
(0, fixtures_1.expect)(parseInt(value) || 0).toBeLessThanOrEqual(20);
|
|
989
|
-
}));
|
|
990
|
-
(0, fixtures_1.test)("setting valid integer step adds that value to input", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
991
|
-
yield initTestBed(`<NumberBox step="5" initialValue="10" />`);
|
|
992
|
-
const incrementButton = page
|
|
993
|
-
.locator("button")
|
|
994
|
-
.filter({ hasText: /increment|up|\+/ })
|
|
995
|
-
.first();
|
|
996
|
-
if (yield incrementButton.isVisible()) {
|
|
997
|
-
yield incrementButton.click();
|
|
998
|
-
yield (0, fixtures_1.expect)(page.getByRole("textbox")).toHaveValue("15");
|
|
999
|
-
}
|
|
1000
|
-
}));
|
|
1001
|
-
(0, fixtures_1.test)("invalid step values use default step", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
1002
|
-
yield initTestBed(`<NumberBox step="invalid" initialValue="10" />`);
|
|
1003
|
-
const incrementButton = page
|
|
1004
|
-
.locator("button")
|
|
1005
|
-
.filter({ hasText: /increment|up|\+/ })
|
|
1006
|
-
.first();
|
|
1007
|
-
if (yield incrementButton.isVisible()) {
|
|
1008
|
-
yield incrementButton.click();
|
|
1009
|
-
yield (0, fixtures_1.expect)(page.getByRole("textbox")).toHaveValue("11"); // Default step is 1
|
|
1010
|
-
}
|
|
1011
|
-
}));
|
|
1012
|
-
(0, fixtures_1.test)("clicking spinbox up-arrow that would overflow max value does not add value", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, }) {
|
|
1013
|
-
yield initTestBed(`<NumberBox maxValue="10" initialValue="10" />`);
|
|
1014
|
-
const incrementButton = page
|
|
1015
|
-
.locator("button")
|
|
1016
|
-
.filter({ hasText: /increment|up|\+/ })
|
|
1017
|
-
.first();
|
|
1018
|
-
if (yield incrementButton.isVisible()) {
|
|
1019
|
-
yield incrementButton.click();
|
|
1020
|
-
yield (0, fixtures_1.expect)(page.getByRole("textbox")).toHaveValue("10");
|
|
1021
|
-
}
|
|
1022
|
-
}));
|
|
1023
|
-
(0, fixtures_1.test)("pressing the up arrow that would overflow max value does not add value", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, }) {
|
|
1024
|
-
yield initTestBed(`<NumberBox maxValue="10" initialValue="10" />`);
|
|
1025
|
-
const input = page.getByRole("textbox");
|
|
1026
|
-
yield input.focus();
|
|
1027
|
-
yield page.keyboard.press("ArrowUp");
|
|
1028
|
-
yield (0, fixtures_1.expect)(input).toHaveValue("10");
|
|
1029
|
-
}));
|
|
1030
|
-
(0, fixtures_1.test)("clicking spinbox down-arrow that would underflow min value does not subtract value", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, }) {
|
|
1031
|
-
yield initTestBed(`<NumberBox minValue="5" initialValue="5" />`);
|
|
1032
|
-
const decrementButton = page
|
|
1033
|
-
.locator("button")
|
|
1034
|
-
.filter({ hasText: /decrement|down|\-/ })
|
|
1035
|
-
.first();
|
|
1036
|
-
if (yield decrementButton.isVisible()) {
|
|
1037
|
-
yield decrementButton.click();
|
|
1038
|
-
yield (0, fixtures_1.expect)(page.getByRole("textbox")).toHaveValue("5");
|
|
1039
|
-
}
|
|
1040
|
-
}));
|
|
1041
|
-
(0, fixtures_1.test)("pressing the down arrow that would underflow min value does not subtract value", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, }) {
|
|
1042
|
-
yield initTestBed(`<NumberBox minValue="5" initialValue="5" />`);
|
|
1043
|
-
const input = page.getByRole("textbox");
|
|
1044
|
-
yield input.focus();
|
|
1045
|
-
yield page.keyboard.press("ArrowDown");
|
|
1046
|
-
yield (0, fixtures_1.expect)(input).toHaveValue("5");
|
|
1047
|
-
}));
|
|
1048
778
|
// Complex edge cases
|
|
1049
779
|
(0, fixtures_1.test)("handle special characters in input", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
1050
780
|
yield initTestBed(`<NumberBox />`);
|
|
@@ -1077,21 +807,6 @@ fixtures_1.test.describe("Other Edge Cases", () => {
|
|
|
1077
807
|
yield input.pressSequentially("456", { delay: 25 });
|
|
1078
808
|
yield (0, fixtures_1.expect)(input).toHaveValue("456");
|
|
1079
809
|
}));
|
|
1080
|
-
(0, fixtures_1.test)("component works correctly in layout contexts", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
1081
|
-
yield initTestBed(`
|
|
1082
|
-
<Stack>
|
|
1083
|
-
<NumberBox label="First" />
|
|
1084
|
-
<NumberBox label="Second" />
|
|
1085
|
-
</Stack>
|
|
1086
|
-
`);
|
|
1087
|
-
yield (0, fixtures_1.expect)(page.getByLabel("First")).toBeVisible();
|
|
1088
|
-
yield (0, fixtures_1.expect)(page.getByLabel("Second")).toBeVisible();
|
|
1089
|
-
}));
|
|
1090
|
-
(0, fixtures_1.test)("component integrates with forms correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
1091
|
-
yield initTestBed(`<NumberBox name="amount" required="true" />`);
|
|
1092
|
-
const input = page.getByRole("textbox");
|
|
1093
|
-
yield (0, fixtures_1.expect)(input).toHaveAttribute("required");
|
|
1094
|
-
}));
|
|
1095
810
|
(0, fixtures_1.test)("component works with conditional rendering", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
1096
811
|
yield initTestBed(`
|
|
1097
812
|
<Fragment>
|
|
@@ -1105,52 +820,26 @@ fixtures_1.test.describe("Other Edge Cases", () => {
|
|
|
1105
820
|
yield page.getByRole("button", { name: "test" }).click();
|
|
1106
821
|
yield (0, fixtures_1.expect)(page.getByRole("textbox")).toBeVisible();
|
|
1107
822
|
}));
|
|
1108
|
-
(0, fixtures_1.test)("spinner buttons work with long press", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
823
|
+
(0, fixtures_1.test)("spinner buttons work with long press", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createNumberBoxDriver, page, }) {
|
|
1109
824
|
yield initTestBed(`<NumberBox initialValue="0" />`);
|
|
1110
|
-
const
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
yield
|
|
1127
|
-
|
|
1128
|
-
.locator("button")
|
|
1129
|
-
.filter({ hasText: /increment|up|\+/ })
|
|
1130
|
-
.first();
|
|
1131
|
-
if (yield incrementButton.isVisible()) {
|
|
1132
|
-
yield incrementButton.click();
|
|
1133
|
-
yield (0, fixtures_1.expect)(page.getByRole("textbox")).toHaveValue("5"); // Should not change
|
|
1134
|
-
}
|
|
1135
|
-
}));
|
|
1136
|
-
(0, fixtures_1.test)("integersOnly with zeroOrPositive combination works", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
1137
|
-
yield initTestBed(`<NumberBox integersOnly="true" zeroOrPositive="true" initialValue="5" />`);
|
|
1138
|
-
const input = page.getByRole("textbox");
|
|
1139
|
-
// Try to go negative
|
|
1140
|
-
const decrementButton = page
|
|
1141
|
-
.locator("button")
|
|
1142
|
-
.filter({ hasText: /decrement|down|\-/ })
|
|
1143
|
-
.first();
|
|
1144
|
-
if (yield decrementButton.isVisible()) {
|
|
1145
|
-
for (let i = 0; i < 10; i++) {
|
|
1146
|
-
yield decrementButton.click();
|
|
1147
|
-
}
|
|
1148
|
-
yield (0, fixtures_1.expect)(input).toHaveValue("0"); // Should stop at 0
|
|
1149
|
-
}
|
|
1150
|
-
// Try to add decimal
|
|
1151
|
-
yield input.focus();
|
|
1152
|
-
yield page.keyboard.type(".5");
|
|
1153
|
-
yield (0, fixtures_1.expect)(input).not.toHaveValue("0.5"); // Should not allow decimal
|
|
825
|
+
const driver = yield createNumberBoxDriver();
|
|
826
|
+
// Hold down the button (simulate long press)
|
|
827
|
+
yield driver.spinnerUp.hover();
|
|
828
|
+
yield page.mouse.down();
|
|
829
|
+
yield page.waitForTimeout(600); // Wait longer than initial delay
|
|
830
|
+
yield page.mouse.up();
|
|
831
|
+
// Should have incremented multiple times
|
|
832
|
+
yield (0, fixtures_1.expect)(driver.input).not.toHaveValue("0");
|
|
833
|
+
}));
|
|
834
|
+
(0, fixtures_1.test)("integersOnly with zeroOrPositive combination works", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createNumberBoxDriver, page, }) {
|
|
835
|
+
yield initTestBed(`<NumberBox integersOnly="true" zeroOrPositive="true" initialValue="1" />`);
|
|
836
|
+
const driver = yield createNumberBoxDriver();
|
|
837
|
+
yield driver.decrement();
|
|
838
|
+
yield (0, fixtures_1.expect)(driver.input).toHaveValue("0");
|
|
839
|
+
yield driver.decrement();
|
|
840
|
+
yield (0, fixtures_1.expect)(driver.input).toHaveValue("0");
|
|
841
|
+
yield driver.input.type(".5");
|
|
842
|
+
yield (0, fixtures_1.expect)(driver.input).toHaveValue("5");
|
|
1154
843
|
}));
|
|
1155
844
|
// Special numeric formats
|
|
1156
845
|
(0, fixtures_1.test)("handle special numeric input formats", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|