xmlui 0.10.15 → 0.10.18

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.
Files changed (86) hide show
  1. package/dist/lib/{index-axjeT2uJ.mjs → index-Cy6Emsex.mjs} +3452 -1954
  2. package/dist/lib/index.css +1 -1
  3. package/dist/lib/{initMock-BoTWMs19.mjs → initMock-B-rmnC-t.mjs} +1 -1
  4. package/dist/lib/xmlui-parser.d.ts +1 -1
  5. package/dist/lib/xmlui.d.ts +4 -6
  6. package/dist/lib/xmlui.mjs +1 -1
  7. package/dist/metadata/{collectedComponentMetadata-CQywuPDB.mjs → collectedComponentMetadata-CB63ngkU.mjs} +3845 -2357
  8. package/dist/metadata/{initMock-Bi5kF5Af.mjs → initMock-D0wDKF_I.mjs} +1 -1
  9. package/dist/metadata/style.css +1 -1
  10. package/dist/metadata/xmlui-metadata.mjs +1 -1
  11. package/dist/metadata/xmlui-metadata.umd.js +3 -3
  12. package/dist/scripts/package.json +1 -1
  13. package/dist/scripts/src/components/Accordion/Accordion.spec.js +1 -1
  14. package/dist/scripts/src/components/Accordion/AccordionItemNative.js +1 -1
  15. package/dist/scripts/src/components/Animation/AnimationNative.js +5 -1
  16. package/dist/scripts/src/components/AutoComplete/AutoComplete.js +1 -5
  17. package/dist/scripts/src/components/AutoComplete/AutoComplete.spec.js +29 -0
  18. package/dist/scripts/src/components/AutoComplete/AutoCompleteContext.js +2 -0
  19. package/dist/scripts/src/components/AutoComplete/AutoCompleteNative.js +262 -62
  20. package/dist/scripts/src/components/Checkbox/Checkbox.js +1 -5
  21. package/dist/scripts/src/components/ColorPicker/ColorPicker.js +2 -6
  22. package/dist/scripts/src/components/ColorPicker/ColorPicker.spec.js +29 -0
  23. package/dist/scripts/src/components/ColorPicker/ColorPickerNative.js +12 -9
  24. package/dist/scripts/src/components/ComponentProvider.js +2 -0
  25. package/dist/scripts/src/components/DateInput/DateInput.js +1 -5
  26. package/dist/scripts/src/components/DateInput/DateInput.spec.js +29 -0
  27. package/dist/scripts/src/components/DateInput/DateInputNative.js +12 -16
  28. package/dist/scripts/src/components/DatePicker/DatePicker.js +1 -5
  29. package/dist/scripts/src/components/DatePicker/DatePicker.spec.js +29 -0
  30. package/dist/scripts/src/components/DatePicker/DatePickerNative.js +12 -13
  31. package/dist/scripts/src/components/FileInput/FileInput.js +1 -5
  32. package/dist/scripts/src/components/FileInput/FileInput.spec.js +29 -0
  33. package/dist/scripts/src/components/FileInput/FileInputNative.js +14 -15
  34. package/dist/scripts/src/components/Form/Form.spec.js +11 -9
  35. package/dist/scripts/src/components/Form/FormNative.js +41 -27
  36. package/dist/scripts/src/components/FormItem/FormItem.spec.js +179 -30
  37. package/dist/scripts/src/components/FormItem/FormItemNative.js +20 -22
  38. package/dist/scripts/src/components/FormItem/ItemWithLabel.js +8 -17
  39. package/dist/scripts/src/components/FormItem/Validations.js +25 -6
  40. package/dist/scripts/src/components/Icon/IconNative.js +18 -15
  41. package/dist/scripts/src/components/Input/PartialInput.js +2 -2
  42. package/dist/scripts/src/components/NestedApp/AppWithCodeViewNative.js +1 -1
  43. package/dist/scripts/src/components/NumberBox/NumberBox.js +5 -9
  44. package/dist/scripts/src/components/NumberBox/NumberBox.spec.js +142 -430
  45. package/dist/scripts/src/components/NumberBox/NumberBoxNative.js +33 -21
  46. package/dist/scripts/src/components/Option/Option.js +3 -1
  47. package/dist/scripts/src/components/RadioGroup/RadioGroup.js +1 -5
  48. package/dist/scripts/src/components/RadioGroup/RadioGroupNative.js +4 -5
  49. package/dist/scripts/src/components/RadioGroup/RadioItem.js +28 -0
  50. package/dist/scripts/src/components/Select/HiddenOption.js +1 -1
  51. package/dist/scripts/src/components/Select/Select.js +1 -5
  52. package/dist/scripts/src/components/Select/Select.spec.js +31 -3
  53. package/dist/scripts/src/components/Select/SelectNative.js +26 -32
  54. package/dist/scripts/src/components/Slider/Slider.js +1 -5
  55. package/dist/scripts/src/components/Slider/Slider.spec.js +75 -13
  56. package/dist/scripts/src/components/Slider/SliderNative.js +33 -24
  57. package/dist/scripts/src/components/Switch/Switch.js +1 -5
  58. package/dist/scripts/src/components/TextArea/TextArea.js +1 -5
  59. package/dist/scripts/src/components/TextArea/TextArea.spec.js +29 -0
  60. package/dist/scripts/src/components/TextArea/TextAreaNative.js +8 -29
  61. package/dist/scripts/src/components/TextBox/TextBox.spec.js +38 -7
  62. package/dist/scripts/src/components/TextBox/TextBoxNative.js +2 -2
  63. package/dist/scripts/src/components/TimeInput/TimeInput.spec.js +31 -0
  64. package/dist/scripts/src/components/Timer/Timer.spec.js +66 -96
  65. package/dist/scripts/src/components/Toggle/Toggle.js +28 -25
  66. package/dist/scripts/src/components/Tree/Tree-dynamic.spec.js +2894 -0
  67. package/dist/scripts/src/components/Tree/Tree-icons.spec.js +206 -0
  68. package/dist/scripts/src/components/Tree/Tree.spec.js +2839 -0
  69. package/dist/scripts/src/components/Tree/TreeComponent.js +303 -10
  70. package/dist/scripts/src/components/Tree/TreeNative.js +1090 -23
  71. package/dist/scripts/src/components/Tree/testData.js +296 -0
  72. package/dist/scripts/src/components-core/behaviors/Behavior.js +2 -0
  73. package/dist/scripts/src/components-core/behaviors/CoreBehaviors.js +8 -4
  74. package/dist/scripts/src/components-core/rendering/AppRoot.js +1 -2
  75. package/dist/scripts/src/components-core/rendering/ComponentAdapter.js +13 -15
  76. package/dist/scripts/src/components-core/utils/treeUtils.js +190 -12
  77. package/dist/scripts/src/testing/ComponentDrivers.js +79 -7
  78. package/dist/scripts/src/testing/drivers/NumberBoxDriver.js +2 -2
  79. package/dist/scripts/src/testing/drivers/TreeDriver.js +13 -0
  80. package/dist/scripts/src/testing/fixtures.js +7 -2
  81. package/dist/standalone/xmlui-standalone.es.d.ts +4 -6
  82. package/dist/standalone/xmlui-standalone.umd.js +36 -36
  83. package/package.json +1 -1
  84. package/dist/scripts/src/components/Animation/Animation.js +0 -50
  85. package/dist/scripts/src/components-core/behaviors/BehaviorContext.js +0 -54
  86. package/dist/scripts/src/testing/drivers/SliderDriver.js +0 -20
@@ -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
- { label: "integer", value: "'{1}'", toExpect: "1" },
33
- { label: "float", value: "'{1.2}'", toExpect: "1.2" },
34
- { label: "undefined", value: "'{undefined}'", toExpect: "" },
35
- { label: "null", value: "'{null}'", toExpect: "" },
36
- { label: "empty string", value: "''", toExpect: "" },
37
- { label: "string that resolves to integer", value: "'1'", toExpect: "1" },
38
- { label: "string that resolves to float", value: "'1.2'", toExpect: "1.2" },
39
- ].forEach(({ label, value, toExpect }) => {
40
- (0, fixtures_1.test)(`initialValue accepts ${label} type with ${value}`, (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
41
- yield initTestBed(`<NumberBox initialValue=${value} />`);
42
- yield (0, fixtures_1.expect)(page.getByRole("textbox")).toHaveValue(toExpect);
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=false prevents user input", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
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)("enabled=true prevents user input", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
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
- // Try to find spinbox buttons (implementation may vary)
65
- const spinButtons = page.locator("button");
66
- const firstSpinButton = spinButtons.first();
67
- if (yield firstSpinButton.isEnabled()) {
68
- yield firstSpinButton.click();
69
- yield (0, fixtures_1.expect)(page.getByRole("textbox")).toHaveValue("5"); // Should not change
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" />`);
@@ -112,11 +106,6 @@ fixtures_1.test.describe("Basic Functionality", () => {
112
106
  const driver = yield createNumberBoxDriver();
113
107
  yield (0, fixtures_1.expect)(driver.input).toBeFocused();
114
108
  }));
115
- (0, fixtures_1.test)("autoFocus focuses input on mount with label", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createNumberBoxDriver }) {
116
- yield initTestBed(`<NumberBox autoFocus="true" label="Auto-focused input" />`);
117
- const driver = yield createNumberBoxDriver();
118
- yield (0, fixtures_1.expect)(driver.input).toBeFocused();
119
- }));
120
109
  // --- placeholder prop
121
110
  (0, fixtures_1.test)("placeholder shows when input is empty", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
122
111
  yield initTestBed(`<NumberBox placeholder="Enter number..." />`);
@@ -124,8 +113,7 @@ fixtures_1.test.describe("Basic Functionality", () => {
124
113
  }));
125
114
  (0, fixtures_1.test)("placeholder does not appear if input is filled", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
126
115
  yield initTestBed(`<NumberBox placeholder="placeholder text" initialValue="123" />`);
127
- yield (0, fixtures_1.expect)(page.getByRole("textbox")).toHaveAttribute("placeholder", "placeholder text");
128
- yield (0, fixtures_1.expect)(page.getByRole("textbox", { name: "placeholder text" })).toBeVisible();
116
+ yield (0, fixtures_1.expect)(page.getByText("placeholder text")).not.toBeVisible();
129
117
  }));
130
118
  // --- maxLength prop
131
119
  (0, fixtures_1.test)("maxLength limits input length", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
@@ -167,37 +155,23 @@ fixtures_1.test.describe("Basic Functionality", () => {
167
155
  (0, fixtures_1.expect)(spinButtonCount).toBe(0);
168
156
  }));
169
157
  // --- step prop with spinbox
170
- (0, fixtures_1.test)("clicking spinbox up-arrow adds step value", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
171
- yield initTestBed(`<NumberBox initialValue="5" step="1" />`);
172
- const incrementButton = page.locator("button").first();
173
- if (yield incrementButton.isVisible()) {
174
- yield incrementButton.click();
175
- yield (0, fixtures_1.expect)(page.getByRole("textbox")).toHaveValue("6");
176
- }
177
- }));
178
- (0, fixtures_1.test)("clicking spinbox down-arrow subtracts step value", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
179
- yield initTestBed(`<NumberBox initialValue="5" step="1" />`);
180
- const decrementButton = page.locator("button").nth(1);
181
- if (yield decrementButton.isVisible()) {
182
- yield decrementButton.click();
183
- yield (0, fixtures_1.expect)(page.getByRole("textbox")).toHaveValue("4");
184
- }
185
- }));
186
- (0, fixtures_1.test)("custom step value applies correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
187
- yield initTestBed(`<NumberBox initialValue="10" step="5" />`);
188
- const incrementButton = page.locator("button").first();
189
- if (yield incrementButton.isVisible()) {
190
- yield incrementButton.click();
191
- yield (0, fixtures_1.expect)(page.getByRole("textbox")).toHaveValue("15");
192
- }
193
- }));
194
- (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 }) {
195
171
  yield initTestBed(`<NumberBox initialValue="10" step="3.5" />`);
196
- const incrementButton = page.locator("button").first();
197
- if (yield incrementButton.isVisible()) {
198
- yield incrementButton.click();
199
- yield (0, fixtures_1.expect)(page.getByRole("textbox")).toHaveValue("11");
200
- }
172
+ const driver = yield createNumberBoxDriver();
173
+ yield driver.increment();
174
+ yield (0, fixtures_1.expect)(driver.input).toHaveValue("11");
201
175
  }));
202
176
  // --- Arrow key navigation
203
177
  (0, fixtures_1.test)("pressing up arrow adds step value", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
@@ -223,50 +197,44 @@ fixtures_1.test.describe("Basic Functionality", () => {
223
197
  yield (0, fixtures_1.expect)(input).not.toHaveValue("123.45");
224
198
  }));
225
199
  // --- zeroOrPositive prop
226
- (0, fixtures_1.test)("zeroOrPositive=true prevents negative values", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
227
- yield initTestBed(`<NumberBox zeroOrPositive="true" initialValue="5" />`);
228
- const input = page.getByRole("textbox");
229
- const decrementButton = page.locator("button").nth(1);
230
- if (yield decrementButton.isVisible()) {
231
- // Click multiple times to try to go negative
232
- for (let i = 0; i < 10; i++) {
233
- yield decrementButton.click();
234
- }
235
- // Should not go below 0
236
- const value = yield input.inputValue();
237
- (0, fixtures_1.expect)(parseInt(value) || 0).toBeGreaterThanOrEqual(0);
238
- }
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");
239
207
  }));
240
208
  // --- Range validation (min/max)
241
- (0, fixtures_1.test)("minValue prevents values below minimum", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
242
- yield initTestBed(`<NumberBox minValue="10" initialValue="15" />`);
243
- const decrementButton = page
244
- .locator("button")
245
- .filter({ hasText: /decrement|down|\-/ })
246
- .first();
247
- if (yield decrementButton.isVisible()) {
248
- // Click multiple times to try to go below minimum
249
- for (let i = 0; i < 10; i++) {
250
- yield decrementButton.click();
251
- }
252
- const value = yield page.getByRole("textbox").inputValue();
253
- (0, fixtures_1.expect)(parseInt(value) || 0).toBeGreaterThanOrEqual(10);
254
- }
255
- }));
256
- (0, fixtures_1.test)("maxValue prevents values above maximum", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
257
- yield initTestBed(`<NumberBox maxValue="20" initialValue="15" />`);
258
- const incrementButton = page
259
- .locator("button")
260
- .filter({ hasText: /increment|up|\+/ })
261
- .first();
262
- if (yield incrementButton.isVisible()) {
263
- // Click multiple times to try to go above maximum
264
- for (let i = 0; i < 10; i++) {
265
- yield incrementButton.click();
266
- }
267
- const value = yield page.getByRole("textbox").inputValue();
268
- (0, fixtures_1.expect)(parseInt(value) || 0).toBeLessThanOrEqual(20);
269
- }
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");
270
238
  }));
271
239
  });
272
240
  // =============================================================================
@@ -275,11 +243,8 @@ fixtures_1.test.describe("Basic Functionality", () => {
275
243
  fixtures_1.test.describe("Accessibility", () => {
276
244
  (0, fixtures_1.test)("has correct role", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
277
245
  yield initTestBed(`<NumberBox testId="input" hasSpinBox="true" />`);
278
- const spinButtons = page.getByTestId("input").locator("button");
279
- for (let i = 0; i < (yield spinButtons.count()); i++) {
280
- const button = spinButtons.nth(i);
281
- yield (0, fixtures_1.expect)(button).toHaveAttribute("role", "spinbutton");
282
- }
246
+ yield (0, fixtures_1.expect)(page.getByRole("spinbutton")).toHaveCount(2);
247
+ yield (0, fixtures_1.expect)(page.getByRole("textbox")).toBeVisible();
283
248
  }));
284
249
  (0, fixtures_1.test)("component supports keyboard navigation", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
285
250
  yield initTestBed(`<NumberBox label="Amount" />`);
@@ -290,22 +255,6 @@ fixtures_1.test.describe("Accessibility", () => {
290
255
  yield initTestBed(`<NumberBox required="true" label="Required field" />`);
291
256
  yield (0, fixtures_1.expect)(page.getByRole("textbox")).toHaveAttribute("required");
292
257
  }));
293
- (0, fixtures_1.test)("disabled component has proper attribute", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
294
- yield initTestBed(`<NumberBox enabled="false" />`);
295
- yield (0, fixtures_1.expect)(page.getByRole("textbox")).toBeDisabled();
296
- }));
297
- (0, fixtures_1.test)("readOnly has proper ARIA attributes", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
298
- yield initTestBed(`<NumberBox readOnly="true" />`);
299
- yield (0, fixtures_1.expect)(page.getByRole("textbox")).toHaveAttribute("readonly");
300
- }));
301
- (0, fixtures_1.test)("spinbox buttons are accessible when present", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
302
- yield initTestBed(`<NumberBox />`);
303
- const spinButtons = page.locator("button");
304
- for (let i = 0; i < (yield spinButtons.count()); i++) {
305
- const button = spinButtons.nth(i);
306
- yield (0, fixtures_1.expect)(button).toHaveAttribute("role", "spinbutton");
307
- }
308
- }));
309
258
  });
310
259
  // =============================================================================
311
260
  // LABEL POSITIONING TESTS
@@ -388,27 +337,11 @@ fixtures_1.test.describe("Event Handling", () => {
388
337
  yield page.getByRole("textbox").fill("123");
389
338
  yield fixtures_1.expect.poll(testStateDriver.testState).toBe("123");
390
339
  }));
391
- (0, fixtures_1.test)("onDidChange is called on input change", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
392
- const { testStateDriver } = yield initTestBed(`<NumberBox onDidChange="testState = 'test'" />`);
393
- yield page.getByRole("textbox").fill("1");
394
- yield fixtures_1.expect.poll(testStateDriver.testState).toBe("test");
395
- }));
396
- (0, fixtures_1.test)("onDidChange function changes are properly reflected", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
397
- const { testStateDriver } = yield initTestBed(`<NumberBox onDidChange="arg => testState = arg" />`);
398
- yield page.getByRole("textbox").fill("123");
399
- yield fixtures_1.expect.poll(testStateDriver.testState).toBe("123");
400
- }));
401
340
  (0, fixtures_1.test)("gotFocus event fires on focus", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
402
341
  const { testStateDriver } = yield initTestBed(`<NumberBox onGotFocus="testState = 'focused'" />`);
403
342
  yield page.getByRole("textbox").focus();
404
343
  yield fixtures_1.expect.poll(testStateDriver.testState).toBe("focused");
405
344
  }));
406
- (0, fixtures_1.test)("gotFocus event fires on focusing the field", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
407
- const { testStateDriver } = yield initTestBed(`<NumberBox onGotFocus="testState = true" />`);
408
- yield page.getByRole("textbox").focus();
409
- yield (0, fixtures_1.expect)(page.getByRole("textbox")).toBeFocused();
410
- yield fixtures_1.expect.poll(testStateDriver.testState).toEqual(true);
411
- }));
412
345
  (0, fixtures_1.test)("lostFocus event fires on blur", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
413
346
  const { testStateDriver } = yield initTestBed(`<NumberBox onLostFocus="testState = 'blurred'" />`);
414
347
  const input = page.getByRole("textbox");
@@ -416,14 +349,6 @@ fixtures_1.test.describe("Event Handling", () => {
416
349
  yield input.blur();
417
350
  yield fixtures_1.expect.poll(testStateDriver.testState).toBe("blurred");
418
351
  }));
419
- (0, fixtures_1.test)("lostFocus event fires when field is blurred", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
420
- const { testStateDriver } = yield initTestBed(`<NumberBox onLostFocus="testState = true" />`);
421
- const input = page.getByRole("textbox");
422
- yield input.focus();
423
- yield input.blur();
424
- yield (0, fixtures_1.expect)(input).not.toBeFocused();
425
- yield fixtures_1.expect.poll(testStateDriver.testState).toEqual(true);
426
- }));
427
352
  (0, fixtures_1.test)("events do not fire when component is disabled", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
428
353
  const { testStateDriver } = yield initTestBed(`
429
354
  <NumberBox enabled="false" onDidChange="testState = 'changed'" onGotFocus="testState = 'focused'" />
@@ -459,15 +384,6 @@ fixtures_1.test.describe("API", () => {
459
384
  yield page.getByRole("button", { name: "test" }).click();
460
385
  yield fixtures_1.expect.poll(testStateDriver.testState).toBe("456");
461
386
  }));
462
- (0, fixtures_1.test)("value returns current input value", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
463
- const { testStateDriver } = yield initTestBed(`
464
- <Fragment>
465
- <NumberBox id="numberbox" initialValue="123" />
466
- <Button label="test" onClick="testState = numberbox.value" />
467
- </Fragment>`);
468
- yield page.getByRole("button", { name: "test" }).click();
469
- yield fixtures_1.expect.poll(testStateDriver.testState).toBe(123);
470
- }));
471
387
  (0, fixtures_1.test)("setValue API updates state", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
472
388
  yield initTestBed(`
473
389
  <Fragment>
@@ -478,15 +394,6 @@ fixtures_1.test.describe("API", () => {
478
394
  yield page.getByRole("button", { name: "test" }).click();
479
395
  yield (0, fixtures_1.expect)(page.getByRole("textbox")).toHaveValue("789");
480
396
  }));
481
- (0, fixtures_1.test)("setValue updates input value", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
482
- yield initTestBed(`
483
- <Fragment>
484
- <NumberBox id="numberbox" />
485
- <Button label="test" onClick="numberbox.setValue(456)" />
486
- </Fragment>`);
487
- yield page.getByRole("button", { name: "test" }).click();
488
- yield (0, fixtures_1.expect)(page.getByRole("textbox")).toHaveValue("456");
489
- }));
490
397
  (0, fixtures_1.test)("setValue API triggers events", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
491
398
  const { testStateDriver } = yield initTestBed(`
492
399
  <Fragment>
@@ -507,15 +414,6 @@ fixtures_1.test.describe("API", () => {
507
414
  yield page.getByRole("button", { name: "test" }).click();
508
415
  yield (0, fixtures_1.expect)(page.getByRole("textbox")).toBeFocused();
509
416
  }));
510
- (0, fixtures_1.test)("focus() focuses the field", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
511
- yield initTestBed(`
512
- <Fragment>
513
- <NumberBox id="numberbox" />
514
- <Button label="test" onClick="numberbox.focus()" />
515
- </Fragment>`);
516
- yield page.getByRole("button", { name: "test" }).click();
517
- yield (0, fixtures_1.expect)(page.getByRole("textbox")).toBeFocused();
518
- }));
519
417
  (0, fixtures_1.test)("focus API does nothing when component is disabled", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
520
418
  yield initTestBed(`
521
419
  <Fragment>
@@ -543,7 +441,7 @@ fixtures_1.test.describe("Input Adornments", () => {
543
441
  const { left: compLeft, right: compRight } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("input"));
544
442
  const { left: textLeft, right: textRight } = yield (0, component_test_helpers_1.getBounds)(page.getByText("$"));
545
443
  yield (0, fixtures_1.expect)(page.getByTestId("input")).toContainText("$");
546
- (0, fixtures_1.expect)(textRight - compLeft).toBeGreaterThanOrEqual(compRight - textLeft);
444
+ (0, fixtures_1.expect)(textRight - compLeft).toBeLessThanOrEqual(compRight - textLeft);
547
445
  }));
548
446
  (0, fixtures_1.test)("endText displays at end of input", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
549
447
  yield initTestBed(`<NumberBox testId="input" direction="ltr" endText="USD" />`);
@@ -557,7 +455,7 @@ fixtures_1.test.describe("Input Adornments", () => {
557
455
  const { left: compLeft, right: compRight } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("input"));
558
456
  const { left: textLeft, right: textRight } = yield (0, component_test_helpers_1.getBounds)(page.getByText("USD"));
559
457
  yield (0, fixtures_1.expect)(page.getByTestId("input")).toContainText("USD");
560
- (0, fixtures_1.expect)(textRight - compLeft).toBeLessThanOrEqual(compRight - textLeft);
458
+ (0, fixtures_1.expect)(textRight - compLeft).toBeGreaterThanOrEqual(compRight - textLeft);
561
459
  }));
562
460
  (0, fixtures_1.test)("startIcon displays at beginning of input", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
563
461
  yield initTestBed(`<NumberBox testId="input" direction="ltr" startIcon="search" />`);
@@ -569,7 +467,7 @@ fixtures_1.test.describe("Input Adornments", () => {
569
467
  yield initTestBed(`<NumberBox testId="input" direction="rtl" startIcon="search" />`);
570
468
  const { left: compLeft, right: compRight } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("input"));
571
469
  const { left: iconLeft, right: iconRight } = yield (0, component_test_helpers_1.getBounds)(page.getByRole("img").first());
572
- (0, fixtures_1.expect)(iconRight - compLeft).toBeGreaterThanOrEqual(compRight - iconLeft);
470
+ (0, fixtures_1.expect)(iconRight - compLeft).toBeLessThanOrEqual(compRight - iconLeft);
573
471
  }));
574
472
  (0, fixtures_1.test)("endIcon displays at end of input", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
575
473
  yield initTestBed(`<NumberBox testId="input" endIcon="search" />`);
@@ -581,7 +479,7 @@ fixtures_1.test.describe("Input Adornments", () => {
581
479
  yield initTestBed(`<NumberBox testId="input" direction="rtl" endIcon="search" />`);
582
480
  const { left: compLeft, right: compRight } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("input"));
583
481
  const { left: iconLeft, right: iconRight } = yield (0, component_test_helpers_1.getBounds)(page.getByRole("img").first());
584
- (0, fixtures_1.expect)(iconRight - compLeft).toBeLessThanOrEqual(compRight - iconLeft);
482
+ (0, fixtures_1.expect)(iconRight - compLeft).toBeGreaterThanOrEqual(compRight - iconLeft);
585
483
  }));
586
484
  (0, fixtures_1.test)("multiple adornments can be combined", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
587
485
  yield initTestBed(`
@@ -803,26 +701,12 @@ fixtures_1.test.describe("Theme Variables", () => {
803
701
  });
804
702
  yield (0, fixtures_1.expect)(page.getByTestId("input")).toHaveCSS("background-color", "rgb(255, 240, 240)");
805
703
  }));
806
- // Warning variant theme variables
807
- (0, fixtures_1.test)("warning variant borderColor applies correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
808
- yield initTestBed(`<NumberBox testId="input" validationStatus="warning" />`, {
809
- testThemeVars: { "borderColor-NumberBox-warning": "rgb(255, 193, 7)" },
810
- });
811
- yield (0, fixtures_1.expect)(page.getByTestId("input")).toHaveCSS("border-color", "rgb(255, 193, 7)");
812
- }));
813
704
  (0, fixtures_1.test)("warning variant textColor applies correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
814
705
  yield initTestBed(`<NumberBox testId="input" validationStatus="warning" />`, {
815
706
  testThemeVars: { "textColor-NumberBox-warning": "rgb(133, 100, 4)" },
816
707
  });
817
708
  yield (0, fixtures_1.expect)(page.getByTestId("input")).toHaveCSS("color", "rgb(133, 100, 4)");
818
709
  }));
819
- // Success variant theme variables
820
- (0, fixtures_1.test)("success variant borderColor applies correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
821
- yield initTestBed(`<NumberBox testId="input" validationStatus="valid" />`, {
822
- testThemeVars: { "borderColor-NumberBox-success": "rgb(40, 167, 69)" },
823
- });
824
- yield (0, fixtures_1.expect)(page.getByTestId("input")).toHaveCSS("border-color", "rgb(40, 167, 69)");
825
- }));
826
710
  (0, fixtures_1.test)("success variant backgroundColor applies correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
827
711
  yield initTestBed(`<NumberBox testId="input" validationStatus="valid" />`, {
828
712
  testThemeVars: { "backgroundColor-NumberBox-success": "rgb(240, 255, 240)" },
@@ -870,14 +754,8 @@ fixtures_1.test.describe("Validation", () => {
870
754
  yield initTestBed(`<NumberBox testId="input" validationStatus="invalid-status" />`, {
871
755
  testThemeVars: {
872
756
  "borderColor-NumberBox": "rgb(0, 0, 0)",
873
- "borderColor-NumberBox-error": "rgb(255, 0, 0)",
874
- "borderColor-NumberBox-warning": "rgb(255, 165, 0)",
875
- "borderColor-NumberBox-success": "rgb(0, 255, 0)",
876
757
  },
877
758
  });
878
- yield (0, fixtures_1.expect)(page.getByTestId("input")).not.toHaveCSS("border-color", "rgb(255, 0, 0)");
879
- yield (0, fixtures_1.expect)(page.getByTestId("input")).not.toHaveCSS("border-color", "rgb(255, 165, 0)");
880
- yield (0, fixtures_1.expect)(page.getByTestId("input")).not.toHaveCSS("border-color", "rgb(0, 255, 0)");
881
759
  yield (0, fixtures_1.expect)(page.getByTestId("input")).toHaveCSS("border-color", "rgb(0, 0, 0)");
882
760
  }));
883
761
  });
@@ -897,156 +775,6 @@ fixtures_1.test.describe("Other Edge Cases", () => {
897
775
  yield initTestBed(`<NumberBox initialValue="{true}" />`);
898
776
  yield (0, fixtures_1.expect)(page.getByRole("textbox")).toHaveValue("");
899
777
  }));
900
- (0, fixtures_1.test)("handles if initialValue is a string", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
901
- yield initTestBed(`<NumberBox initialValue="asdasd" />`);
902
- yield (0, fixtures_1.expect)(page.getByRole("textbox")).toHaveValue("asdasd");
903
- }));
904
- (0, fixtures_1.test)("if initialValue is too large, handles gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
905
- yield initTestBed(`<NumberBox initialValue="100000000000000000000000000000000000" />`);
906
- const input = page.getByRole("textbox");
907
- // Should either clamp to max value or handle the large number appropriately
908
- yield (0, fixtures_1.expect)(input).toBeVisible();
909
- }));
910
- (0, fixtures_1.test)("if initialValue is too small, handles gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
911
- yield initTestBed(`<NumberBox initialValue="-100000000000000000000000000000000000" />`);
912
- const input = page.getByRole("textbox");
913
- // Should either clamp to min value or handle the small number appropriately
914
- yield (0, fixtures_1.expect)(input).toBeVisible();
915
- }));
916
- (0, fixtures_1.test)("focuses component if autoFocus is set", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
917
- yield initTestBed(`<NumberBox autoFocus="{true}" />`);
918
- yield (0, fixtures_1.expect)(page.getByRole("textbox")).toBeFocused();
919
- }));
920
- (0, fixtures_1.test)("readOnly lets user copy from input field", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
921
- yield initTestBed(`<NumberBox initialValue="123" readOnly="{true}" />`);
922
- const input = page.getByRole("textbox");
923
- yield (0, fixtures_1.expect)(input).toHaveValue("123");
924
- yield input.focus();
925
- yield (0, fixtures_1.expect)(input).toBeFocused();
926
- }));
927
- // Range and constraint tests with edge cases
928
- (0, fixtures_1.test)("maxLength caps the length of the input", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
929
- yield initTestBed(`<NumberBox maxLength="3" />`);
930
- const input = page.getByRole("textbox");
931
- yield input.fill("12345");
932
- yield (0, fixtures_1.expect)(input).toHaveValue("123");
933
- }));
934
- (0, fixtures_1.test)("integersOnly limits input to integers", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
935
- yield initTestBed(`<NumberBox integersOnly="true" />`);
936
- const input = page.getByRole("textbox");
937
- yield input.fill("123.45");
938
- // Should not contain decimal
939
- yield (0, fixtures_1.expect)(input).not.toHaveValue("123.45");
940
- }));
941
- (0, fixtures_1.test)("zeroOrPositive limits input to non-negative numbers and zero", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, }) {
942
- yield initTestBed(`<NumberBox zeroOrPositive="true" initialValue="" />`);
943
- yield page.getByRole("textbox").pressSequentially("-5");
944
- const value = yield page.getByRole("textbox").inputValue();
945
- (0, fixtures_1.expect)(parseInt(value) || 0).toBe(5);
946
- }));
947
- (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, }) {
948
- yield initTestBed(`<NumberBox zeroOrPositive="true" initialValue="5" />`);
949
- // Try to decrement below zero using spinbox
950
- const decrementButton = page
951
- .locator("button")
952
- .filter({ hasText: /decrement|down|\-/ })
953
- .first();
954
- if (yield decrementButton.isVisible()) {
955
- for (let i = 0; i < 10; i++) {
956
- yield decrementButton.click();
957
- }
958
- }
959
- const value = yield page.getByRole("textbox").inputValue();
960
- (0, fixtures_1.expect)(parseInt(value) || 0).toBeGreaterThanOrEqual(0);
961
- }));
962
- (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, }) {
963
- yield initTestBed(`<NumberBox minValue="10" initialValue="15" />`);
964
- // Try to decrement below minimum
965
- const decrementButton = page
966
- .locator("button")
967
- .filter({ hasText: /decrement|down|\-/ })
968
- .first();
969
- if (yield decrementButton.isVisible()) {
970
- for (let i = 0; i < 10; i++) {
971
- yield decrementButton.click();
972
- }
973
- }
974
- const value = yield page.getByRole("textbox").inputValue();
975
- (0, fixtures_1.expect)(parseInt(value) || 0).toBeGreaterThanOrEqual(10);
976
- }));
977
- (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, }) {
978
- yield initTestBed(`<NumberBox maxValue="20" initialValue="15" />`);
979
- // Try to increment above maximum
980
- const incrementButton = page
981
- .locator("button")
982
- .filter({ hasText: /increment|up|\+/ })
983
- .first();
984
- if (yield incrementButton.isVisible()) {
985
- for (let i = 0; i < 10; i++) {
986
- yield incrementButton.click();
987
- }
988
- }
989
- const value = yield page.getByRole("textbox").inputValue();
990
- (0, fixtures_1.expect)(parseInt(value) || 0).toBeLessThanOrEqual(20);
991
- }));
992
- (0, fixtures_1.test)("setting valid integer step adds that value to input", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
993
- yield initTestBed(`<NumberBox step="5" initialValue="10" />`);
994
- const incrementButton = page
995
- .locator("button")
996
- .filter({ hasText: /increment|up|\+/ })
997
- .first();
998
- if (yield incrementButton.isVisible()) {
999
- yield incrementButton.click();
1000
- yield (0, fixtures_1.expect)(page.getByRole("textbox")).toHaveValue("15");
1001
- }
1002
- }));
1003
- (0, fixtures_1.test)("invalid step values use default step", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
1004
- yield initTestBed(`<NumberBox step="invalid" initialValue="10" />`);
1005
- const incrementButton = page
1006
- .locator("button")
1007
- .filter({ hasText: /increment|up|\+/ })
1008
- .first();
1009
- if (yield incrementButton.isVisible()) {
1010
- yield incrementButton.click();
1011
- yield (0, fixtures_1.expect)(page.getByRole("textbox")).toHaveValue("11"); // Default step is 1
1012
- }
1013
- }));
1014
- (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, }) {
1015
- yield initTestBed(`<NumberBox maxValue="10" initialValue="10" />`);
1016
- const incrementButton = page
1017
- .locator("button")
1018
- .filter({ hasText: /increment|up|\+/ })
1019
- .first();
1020
- if (yield incrementButton.isVisible()) {
1021
- yield incrementButton.click();
1022
- yield (0, fixtures_1.expect)(page.getByRole("textbox")).toHaveValue("10");
1023
- }
1024
- }));
1025
- (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, }) {
1026
- yield initTestBed(`<NumberBox maxValue="10" initialValue="10" />`);
1027
- const input = page.getByRole("textbox");
1028
- yield input.focus();
1029
- yield page.keyboard.press("ArrowUp");
1030
- yield (0, fixtures_1.expect)(input).toHaveValue("10");
1031
- }));
1032
- (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, }) {
1033
- yield initTestBed(`<NumberBox minValue="5" initialValue="5" />`);
1034
- const decrementButton = page
1035
- .locator("button")
1036
- .filter({ hasText: /decrement|down|\-/ })
1037
- .first();
1038
- if (yield decrementButton.isVisible()) {
1039
- yield decrementButton.click();
1040
- yield (0, fixtures_1.expect)(page.getByRole("textbox")).toHaveValue("5");
1041
- }
1042
- }));
1043
- (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, }) {
1044
- yield initTestBed(`<NumberBox minValue="5" initialValue="5" />`);
1045
- const input = page.getByRole("textbox");
1046
- yield input.focus();
1047
- yield page.keyboard.press("ArrowDown");
1048
- yield (0, fixtures_1.expect)(input).toHaveValue("5");
1049
- }));
1050
778
  // Complex edge cases
1051
779
  (0, fixtures_1.test)("handle special characters in input", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
1052
780
  yield initTestBed(`<NumberBox />`);
@@ -1079,25 +807,6 @@ fixtures_1.test.describe("Other Edge Cases", () => {
1079
807
  yield input.pressSequentially("456", { delay: 25 });
1080
808
  yield (0, fixtures_1.expect)(input).toHaveValue("456");
1081
809
  }));
1082
- (0, fixtures_1.test)("component works correctly in layout contexts", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createNumberBoxDriver }) {
1083
- yield initTestBed(`
1084
- <Stack>
1085
- <NumberBox label="First" testId="first"/>
1086
- <NumberBox label="Second" testId="second" />
1087
- </Stack>
1088
- `);
1089
- const driver1 = yield createNumberBoxDriver("first");
1090
- const driver2 = yield createNumberBoxDriver("second");
1091
- yield (0, fixtures_1.expect)(driver1.input).toBeVisible();
1092
- yield (0, fixtures_1.expect)(driver1.label).toBeVisible();
1093
- yield (0, fixtures_1.expect)(driver2.input).toBeVisible();
1094
- yield (0, fixtures_1.expect)(driver2.label).toBeVisible();
1095
- }));
1096
- (0, fixtures_1.test)("component integrates with forms correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
1097
- yield initTestBed(`<NumberBox name="amount" required="true" />`);
1098
- const input = page.getByRole("textbox");
1099
- yield (0, fixtures_1.expect)(input).toHaveAttribute("required");
1100
- }));
1101
810
  (0, fixtures_1.test)("component works with conditional rendering", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
1102
811
  yield initTestBed(`
1103
812
  <Fragment>
@@ -1111,52 +820,26 @@ fixtures_1.test.describe("Other Edge Cases", () => {
1111
820
  yield page.getByRole("button", { name: "test" }).click();
1112
821
  yield (0, fixtures_1.expect)(page.getByRole("textbox")).toBeVisible();
1113
822
  }));
1114
- (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, }) {
1115
824
  yield initTestBed(`<NumberBox initialValue="0" />`);
1116
- const incrementButton = page
1117
- .locator("button")
1118
- .filter({ hasText: /increment|up|\+/ })
1119
- .first();
1120
- if (yield incrementButton.isVisible()) {
1121
- // Hold down the button (simulate long press)
1122
- yield incrementButton.hover();
1123
- yield page.mouse.down();
1124
- yield page.waitForTimeout(600); // Wait longer than initial delay
1125
- yield page.mouse.up();
1126
- // Should have incremented multiple times
1127
- const value = yield page.getByRole("textbox").inputValue();
1128
- (0, fixtures_1.expect)(parseInt(value) || 0).toBeGreaterThan(1);
1129
- }
1130
- }));
1131
- (0, fixtures_1.test)("readOnly disables spinner buttons", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
1132
- yield initTestBed(`<NumberBox readOnly="true" initialValue="5" />`);
1133
- const incrementButton = page
1134
- .locator("button")
1135
- .filter({ hasText: /increment|up|\+/ })
1136
- .first();
1137
- if (yield incrementButton.isVisible()) {
1138
- yield incrementButton.click();
1139
- yield (0, fixtures_1.expect)(page.getByRole("textbox")).toHaveValue("5"); // Should not change
1140
- }
1141
- }));
1142
- (0, fixtures_1.test)("integersOnly with zeroOrPositive combination works", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
1143
- yield initTestBed(`<NumberBox integersOnly="true" zeroOrPositive="true" initialValue="5" />`);
1144
- const input = page.getByRole("textbox");
1145
- // Try to go negative
1146
- const decrementButton = page
1147
- .locator("button")
1148
- .filter({ hasText: /decrement|down|\-/ })
1149
- .first();
1150
- if (yield decrementButton.isVisible()) {
1151
- for (let i = 0; i < 10; i++) {
1152
- yield decrementButton.click();
1153
- }
1154
- yield (0, fixtures_1.expect)(input).toHaveValue("0"); // Should stop at 0
1155
- }
1156
- // Try to add decimal
1157
- yield input.focus();
1158
- yield page.keyboard.type(".5");
1159
- 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");
1160
843
  }));
1161
844
  // Special numeric formats
1162
845
  (0, fixtures_1.test)("handle special numeric input formats", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
@@ -1235,3 +918,32 @@ fixtures_1.test.describe("Other Edge Cases", () => {
1235
918
  yield (0, fixtures_1.expect)(input).toHaveValue("123.0");
1236
919
  }));
1237
920
  });
921
+ // =============================================================================
922
+ // VISUAL STATE TESTS
923
+ // =============================================================================
924
+ (0, fixtures_1.test)("input has correct width in px", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
925
+ yield initTestBed(`<NumberBox width="200px" testId="test"/>`, {});
926
+ const input = page.getByTestId("test");
927
+ const { width } = yield input.boundingBox();
928
+ (0, fixtures_1.expect)(width).toBe(200);
929
+ }));
930
+ (0, fixtures_1.test)("input with label has correct width in px", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
931
+ yield initTestBed(`<NumberBox width="200px" label="test" testId="test"/>`, {});
932
+ const input = page.getByTestId("test");
933
+ const { width } = yield input.boundingBox();
934
+ (0, fixtures_1.expect)(width).toBe(200);
935
+ }));
936
+ (0, fixtures_1.test)("input has correct width in %", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
937
+ yield page.setViewportSize({ width: 400, height: 300 });
938
+ yield initTestBed(`<NumberBox width="50%" testId="test"/>`, {});
939
+ const input = page.getByTestId("test");
940
+ const { width } = yield input.boundingBox();
941
+ (0, fixtures_1.expect)(width).toBe(200);
942
+ }));
943
+ (0, fixtures_1.test)("input with label has correct width in %", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
944
+ yield page.setViewportSize({ width: 400, height: 300 });
945
+ yield initTestBed(`<NumberBox width="50%" label="test" testId="test"/>`, {});
946
+ const input = page.getByTestId("test");
947
+ const { width } = yield input.boundingBox();
948
+ (0, fixtures_1.expect)(width).toBe(200);
949
+ }));