xmlui 0.10.12 → 0.10.14

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 (209) hide show
  1. package/dist/lib/{index-CDOoBf2R.mjs → index-779mp2Bm.mjs} +1508 -1287
  2. package/dist/lib/index.css +1 -1
  3. package/dist/lib/{initMock-BAV9RKui.mjs → initMock-CAXdczCj.mjs} +1 -1
  4. package/dist/lib/scss/components-core/theming/_themes.scss +1 -1
  5. package/dist/lib/xmlui.d.ts +17 -2
  6. package/dist/lib/xmlui.mjs +33 -32
  7. package/dist/metadata/{collectedComponentMetadata-Dp8BqWQO.mjs → collectedComponentMetadata-7DFXlw-J.mjs} +14957 -14751
  8. package/dist/metadata/{initMock-BvEO8W8r.mjs → initMock-AFWEftc6.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/bin/build-lib.js +21 -13
  13. package/dist/scripts/bin/viteConfig.js +3 -1
  14. package/dist/scripts/package.json +1 -1
  15. package/dist/scripts/src/abstractions/scripting/Token.js +2 -0
  16. package/dist/scripts/src/abstractions/scripting/TryScope.js +2 -0
  17. package/dist/scripts/src/abstractions/scripting/modules.js +2 -0
  18. package/dist/scripts/src/components/APICall/APICall.spec.js +910 -0
  19. package/dist/scripts/src/components/Accordion/Accordion.spec.js +969 -0
  20. package/dist/scripts/src/components/Animation/Animation.js +50 -0
  21. package/dist/scripts/src/components/App/App.spec.js +219 -0
  22. package/dist/scripts/src/components/AppHeader/AppHeader.spec.js +169 -0
  23. package/dist/scripts/src/components/AppState/AppState.spec.js +268 -0
  24. package/dist/scripts/src/components/AutoComplete/AutoComplete.spec.js +383 -0
  25. package/dist/scripts/src/components/Avatar/Avatar.spec.js +1543 -0
  26. package/dist/scripts/src/components/Backdrop/Backdrop.spec.js +131 -0
  27. package/dist/scripts/src/components/Badge/Badge.spec.js +2214 -0
  28. package/dist/scripts/src/components/Bookmark/Bookmark.spec.js +230 -0
  29. package/dist/scripts/src/components/Breakout/Breakout.spec.js +56 -0
  30. package/dist/scripts/src/components/Button/Button-style.spec.js +274 -0
  31. package/dist/scripts/src/components/Button/Button.spec.js +454 -0
  32. package/dist/scripts/src/components/Card/Card.spec.js +150 -0
  33. package/dist/scripts/src/components/Carousel/Carousel.spec.js +343 -0
  34. package/dist/scripts/src/components/Carousel/CarouselNative.js +2 -2
  35. package/dist/scripts/src/components/ChangeListener/ChangeListener.spec.js +169 -0
  36. package/dist/scripts/src/components/Charts/AreaChart/AreaChart.spec.js +999 -0
  37. package/dist/scripts/src/components/Charts/BarChart/BarChart.spec.js +597 -0
  38. package/dist/scripts/src/components/Charts/DonutChart/DonutChart.spec.js +608 -0
  39. package/dist/scripts/src/components/Charts/LabelList/LabelList.spec.js +539 -0
  40. package/dist/scripts/src/components/Charts/Legend/Legend.spec.js +558 -0
  41. package/dist/scripts/src/components/Charts/LineChart/LineChart.spec.js +450 -0
  42. package/dist/scripts/src/components/Charts/PieChart/PieChart.spec.js +584 -0
  43. package/dist/scripts/src/components/Charts/RadarChart/RadarChart.spec.js +571 -0
  44. package/dist/scripts/src/components/Charts/Tooltip/TooltipContent.spec.js +449 -0
  45. package/dist/scripts/src/components/Checkbox/Checkbox.spec.js +964 -0
  46. package/dist/scripts/src/components/CodeBlock/CodeBlock.spec.js +196 -0
  47. package/dist/scripts/src/components/ColorPicker/ColorPicker.js +3 -3
  48. package/dist/scripts/src/components/ColorPicker/ColorPicker.spec.js +283 -0
  49. package/dist/scripts/src/components/ColorPicker/ColorPickerNative.js +16 -5
  50. package/dist/scripts/src/components/Column/doc-resources/list-component-data.js +53 -0
  51. package/dist/scripts/src/components/ComponentProvider.js +6 -6
  52. package/dist/scripts/src/components/ContentSeparator/ContentSeparator.spec.js +338 -0
  53. package/dist/scripts/src/components/DateInput/DateInput.spec.js +918 -0
  54. package/dist/scripts/src/components/DatePicker/DatePicker.spec.js +362 -0
  55. package/dist/scripts/src/components/DatePicker/DatePickerNative.js +3 -3
  56. package/dist/scripts/src/components/DropdownMenu/DropdownMenu.spec.js +331 -0
  57. package/dist/scripts/src/components/DropdownMenu/DropdownMenuNative.js +1 -1
  58. package/dist/scripts/src/components/EmojiSelector/EmojiSelector.spec.js +29 -0
  59. package/dist/scripts/src/components/ExpandableItem/ExpandableItem.spec.js +435 -0
  60. package/dist/scripts/src/components/FileInput/FileInput.spec.js +249 -0
  61. package/dist/scripts/src/components/FileInput/FileInputNative.js +14 -10
  62. package/dist/scripts/src/components/FileUploadDropZone/FileUploadDropZone.spec.js +296 -0
  63. package/dist/scripts/src/components/FileUploadDropZone/FileUploadDropZoneNative.js +1 -1
  64. package/dist/scripts/src/components/FlowLayout/FlowLayout.spec.js +518 -0
  65. package/dist/scripts/src/components/Footer/Footer.spec.js +991 -0
  66. package/dist/scripts/src/components/Form/Form.js +6 -0
  67. package/dist/scripts/src/components/Form/Form.spec.js +1257 -0
  68. package/dist/scripts/src/components/Form/FormNative.js +13 -3
  69. package/dist/scripts/src/components/FormItem/FormItem.spec.js +723 -0
  70. package/dist/scripts/src/components/FormItem/ItemWithLabel.js +2 -2
  71. package/dist/scripts/src/components/FormSection/FormSection.js +6 -31
  72. package/dist/scripts/src/components/Fragment/Fragment.js +5 -1
  73. package/dist/scripts/src/components/Fragment/Fragment.spec.js +50 -0
  74. package/dist/scripts/src/components/Heading/H1.spec.js +66 -0
  75. package/dist/scripts/src/components/Heading/H2.spec.js +66 -0
  76. package/dist/scripts/src/components/Heading/H3.spec.js +66 -0
  77. package/dist/scripts/src/components/Heading/H4.spec.js +66 -0
  78. package/dist/scripts/src/components/Heading/H5.spec.js +66 -0
  79. package/dist/scripts/src/components/Heading/H6.spec.js +66 -0
  80. package/dist/scripts/src/components/Heading/Heading.js +0 -12
  81. package/dist/scripts/src/components/Heading/Heading.spec.js +897 -0
  82. package/dist/scripts/src/components/HtmlTags/HtmlTags.spec.js +69 -0
  83. package/dist/scripts/src/components/IFrame/IFrame.spec.js +527 -0
  84. package/dist/scripts/src/components/Icon/ArrowDropDown.js +11 -0
  85. package/dist/scripts/src/components/Icon/ArrowDropUp.js +11 -0
  86. package/dist/scripts/src/components/Icon/ArrowLeft.js +11 -0
  87. package/dist/scripts/src/components/Icon/ArrowRight.js +11 -0
  88. package/dist/scripts/src/components/Icon/ChevronDownIcon.js +7 -0
  89. package/dist/scripts/src/components/Icon/ChevronUpIcon.js +7 -0
  90. package/dist/scripts/src/components/Icon/Icon.spec.js +527 -0
  91. package/dist/scripts/src/components/Icon/SunIcon.js +10 -0
  92. package/dist/scripts/src/components/Image/Image.js +2 -1
  93. package/dist/scripts/src/components/Image/Image.spec.js +198 -0
  94. package/dist/scripts/src/components/Image/ImageNative.js +30 -2
  95. package/dist/scripts/src/components/Input/InputLabel.js +25 -0
  96. package/dist/scripts/src/components/Input/index.js +5 -0
  97. package/dist/scripts/src/components/Items/Items.spec.js +397 -0
  98. package/dist/scripts/src/components/Link/Link.spec.js +894 -0
  99. package/dist/scripts/src/components/List/List.spec.js +927 -0
  100. package/dist/scripts/src/components/List/doc-resources/list-component-data.js +53 -0
  101. package/dist/scripts/src/components/Markdown/Markdown.spec.js +188 -0
  102. package/dist/scripts/src/components/ModalDialog/ModalDialog.js +1 -1
  103. package/dist/scripts/src/components/ModalDialog/ModalDialog.spec.js +162 -0
  104. package/dist/scripts/src/components/ModalDialog/ModalDialogNative.js +1 -1
  105. package/dist/scripts/src/components/NavGroup/NavGroup.spec.js +153 -0
  106. package/dist/scripts/src/components/NavGroup/NavGroupNative.js +2 -2
  107. package/dist/scripts/src/components/NavLink/NavLink.spec.js +864 -0
  108. package/dist/scripts/src/components/NavPanel/NavPanel.spec.js +864 -0
  109. package/dist/scripts/src/components/NoResult/NoResult.spec.js +863 -0
  110. package/dist/scripts/src/components/NumberBox/NumberBox.spec.js +1231 -0
  111. package/dist/scripts/src/components/Option/Option.spec.js +472 -0
  112. package/dist/scripts/src/components/PageMetaTitle/PageMetaTitle.spec.js +80 -0
  113. package/dist/scripts/src/components/Pagination/Pagination.spec.js +1003 -0
  114. package/dist/scripts/src/components/ProfileMenu/ProfileMenu.js +20 -0
  115. package/dist/scripts/src/components/ProgressBar/ProgressBar.spec.js +166 -0
  116. package/dist/scripts/src/components/Queue/Queue.spec.js +626 -0
  117. package/dist/scripts/src/components/RadioGroup/RadioGroup.spec.js +479 -0
  118. package/dist/scripts/src/components/RadioGroup/RadioGroupNative.js +17 -1
  119. package/dist/scripts/src/components/Redirect/Redirect.spec.js +527 -0
  120. package/dist/scripts/src/components/ResponsiveBar/ResponsiveBar.spec.js +76 -0
  121. package/dist/scripts/src/components/Select/Select.spec.js +527 -0
  122. package/dist/scripts/src/components/Slider/Slider.js +2 -0
  123. package/dist/scripts/src/components/Slider/Slider.spec.js +574 -0
  124. package/dist/scripts/src/components/Slider/SliderNative.js +62 -25
  125. package/dist/scripts/src/components/Slot/Slot.spec.js +368 -0
  126. package/dist/scripts/src/components/SpaceFiller/SpaceFiller.spec.js +184 -0
  127. package/dist/scripts/src/components/Spinner/Spinner.spec.js +161 -0
  128. package/dist/scripts/src/components/Splitter/HSplitter.spec.js +104 -0
  129. package/dist/scripts/src/components/Splitter/Splitter.spec.js +543 -0
  130. package/dist/scripts/src/components/Splitter/VSplitter.spec.js +104 -0
  131. package/dist/scripts/src/components/Stack/CHStack.spec.js +86 -0
  132. package/dist/scripts/src/components/Stack/CVStack.spec.js +86 -0
  133. package/dist/scripts/src/components/Stack/HStack.spec.js +67 -0
  134. package/dist/scripts/src/components/Stack/Stack.spec.js +654 -0
  135. package/dist/scripts/src/components/Stack/VStack.spec.js +67 -0
  136. package/dist/scripts/src/components/Switch/Switch.spec.js +829 -0
  137. package/dist/scripts/src/components/Table/Table.js +8 -5
  138. package/dist/scripts/src/components/Table/Table.spec.js +555 -0
  139. package/dist/scripts/src/components/Table/TableNative.js +1 -1
  140. package/dist/scripts/src/components/Table/doc-resources/list-component-data.js +53 -0
  141. package/dist/scripts/src/components/TableOfContents/TableOfContents.spec.js +838 -0
  142. package/dist/scripts/src/components/Tabs/Tabs.spec.js +875 -0
  143. package/dist/scripts/src/components/Text/Text.js +0 -13
  144. package/dist/scripts/src/components/Text/Text.spec.js +1075 -0
  145. package/dist/scripts/src/components/TextArea/TextArea.spec.js +714 -0
  146. package/dist/scripts/src/components/TextArea/TextAreaNative.js +8 -1
  147. package/dist/scripts/src/components/TextBox/TextBox.spec.js +643 -0
  148. package/dist/scripts/src/components/Theme/NotificationToast.js +4 -1
  149. package/dist/scripts/src/components/Theme/Theme.spec.js +124 -0
  150. package/dist/scripts/src/components/TimeInput/TimeInput.spec.js +1122 -0
  151. package/dist/scripts/src/components/Timer/Timer.spec.js +358 -0
  152. package/dist/scripts/src/components/ToneChangerButton/ToneChangerButton.spec.js +414 -0
  153. package/dist/scripts/src/components/ToneSwitch/ToneSwitch.spec.js +89 -0
  154. package/dist/scripts/src/components/Tooltip/Tooltip.spec.js +418 -0
  155. package/dist/scripts/src/components/chart-color-schemes.js +43 -0
  156. package/dist/scripts/src/components-core/CompoundComponent.js +5 -5
  157. package/dist/scripts/src/components-core/RestApiProxy.js +89 -11
  158. package/dist/scripts/src/components-core/devtools/InspectorDialogVisibilityContext.js +8 -0
  159. package/dist/scripts/src/components-core/renderers.js +31 -0
  160. package/dist/scripts/src/components-core/rendering/ComponentAdapter.js +1 -1
  161. package/dist/scripts/src/components-core/rendering/Container.js +19 -8
  162. package/dist/scripts/src/components-core/rendering/reducer.js +1 -1
  163. package/dist/scripts/src/components-core/script-runner/simplify-expression.js +386 -0
  164. package/dist/scripts/src/components-core/theming/component-layout-resolver.js +153 -0
  165. package/dist/scripts/src/components-core/theming/parse-layout-props.js +98 -0
  166. package/dist/scripts/src/components-core/theming/themes/root.js +13 -20
  167. package/dist/scripts/src/components-core/theming/themes/solid.js +16 -0
  168. package/dist/scripts/src/components-core/utils/audio-utils.js +83 -0
  169. package/dist/scripts/src/index-standalone.js +61 -0
  170. package/dist/scripts/src/index.js +2 -1
  171. package/dist/scripts/src/language-server/server-common.js +151 -0
  172. package/dist/scripts/src/language-server/server-web-worker.js +47 -0
  173. package/dist/scripts/src/language-server/server.js +42 -0
  174. package/dist/scripts/src/language-server/services/common/docs-generation.js +73 -0
  175. package/dist/scripts/src/language-server/services/common/lsp-utils.js +9 -0
  176. package/dist/scripts/src/language-server/services/common/syntax-node-utilities.js +135 -0
  177. package/dist/scripts/src/language-server/services/completion.js +270 -0
  178. package/dist/scripts/src/language-server/services/diagnostic.js +19 -0
  179. package/dist/scripts/src/language-server/services/format.js +430 -0
  180. package/dist/scripts/src/language-server/services/hover.js +164 -0
  181. package/dist/scripts/src/language-server/xmlui-metadata-generated.mjs +16266 -0
  182. package/dist/scripts/src/logging/xmlui.js +21 -0
  183. package/dist/scripts/src/parsers/common/utils.js +19 -0
  184. package/dist/scripts/src/syntax/monaco/grammar.monacoLanguage.js +286 -0
  185. package/dist/scripts/src/syntax/monaco/index.js +14 -0
  186. package/dist/scripts/src/syntax/monaco/xmlui-dark.js +25 -0
  187. package/dist/scripts/src/syntax/monaco/xmlui-light.js +25 -0
  188. package/dist/scripts/src/syntax/monaco/xmluiscript.monacoLanguage.js +310 -0
  189. package/dist/scripts/src/syntax/textMate/index.js +14 -0
  190. package/dist/scripts/src/syntax/textMate/xmlui-dark.json +631 -0
  191. package/dist/scripts/src/syntax/textMate/xmlui-light.json +565 -0
  192. package/dist/scripts/src/syntax/textMate/xmlui.json +564 -0
  193. package/dist/scripts/src/syntax/textMate/xmlui.tmLanguage.json +341 -0
  194. package/dist/scripts/src/testing/ComponentDrivers.js +1355 -0
  195. package/dist/scripts/src/testing/assertions.js +444 -0
  196. package/dist/scripts/src/testing/component-test-helpers.js +389 -0
  197. package/dist/scripts/src/testing/drivers/DateInputDriver.js +19 -0
  198. package/dist/scripts/src/testing/drivers/ModalDialogDriver.js +10 -0
  199. package/dist/scripts/src/testing/drivers/TimeInputDriver.js +22 -0
  200. package/dist/scripts/src/testing/drivers/TimerDriver.js +64 -0
  201. package/dist/scripts/src/testing/fixtures.js +487 -0
  202. package/dist/scripts/src/testing/infrastructure/TestBed.js +17 -0
  203. package/dist/scripts/src/testing/infrastructure/main.js +9 -0
  204. package/dist/scripts/src/testing/infrastructure/public/mockServiceWorker.js +266 -0
  205. package/dist/scripts/src/testing/themed-app-test-helpers.js +139 -0
  206. package/dist/standalone/xmlui-standalone.es.d.ts +19 -2
  207. package/dist/standalone/xmlui-standalone.umd.js +36 -36
  208. package/package.json +1 -1
  209. package/dist/scripts/src/components/RadioGroup/RadioItem.js +0 -28
@@ -0,0 +1,1231 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const component_test_helpers_1 = require("../../testing/component-test-helpers");
13
+ const fixtures_1 = require("../../testing/fixtures");
14
+ // =============================================================================
15
+ // BASIC FUNCTIONALITY TESTS
16
+ // =============================================================================
17
+ fixtures_1.test.describe("Basic Functionality", () => {
18
+ (0, fixtures_1.test)("component renders", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
19
+ yield initTestBed(`<NumberBox />`);
20
+ yield (0, fixtures_1.expect)(page.getByRole("textbox")).toBeVisible();
21
+ }));
22
+ (0, fixtures_1.test)("component renders with label", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
23
+ yield initTestBed(`<NumberBox label="Amount" />`);
24
+ yield (0, fixtures_1.expect)(page.getByText("Amount")).toBeVisible();
25
+ }));
26
+ // --- initialValue prop
27
+ (0, fixtures_1.test)("initialValue sets field value", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
28
+ yield initTestBed(`<NumberBox initialValue="123" />`);
29
+ yield (0, fixtures_1.expect)(page.getByRole("textbox")).toHaveValue("123");
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
+ });
45
+ // --- enabled prop
46
+ (0, fixtures_1.test)("enabled=false disables control", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
47
+ yield initTestBed(`<NumberBox enabled="false" />`);
48
+ yield (0, fixtures_1.expect)(page.getByRole("textbox")).toBeDisabled();
49
+ }));
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 }) {
55
+ yield initTestBed(`<NumberBox enabled="true" />`);
56
+ yield (0, fixtures_1.expect)(page.getByRole("textbox")).not.toBeDisabled();
57
+ }));
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 }) {
63
+ 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
+ }
71
+ }));
72
+ // --- readOnly prop
73
+ (0, fixtures_1.test)("readOnly adds readonly attribute", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
74
+ yield initTestBed(`<NumberBox readOnly="true" initialValue="123" />`);
75
+ const input = page.getByRole("textbox");
76
+ yield (0, fixtures_1.expect)(input).toHaveAttribute("readonly");
77
+ }));
78
+ (0, fixtures_1.test)("readOnly input is not editable", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
79
+ yield initTestBed(`<NumberBox readOnly="true" initialValue="123" />`);
80
+ const input = page.getByRole("textbox");
81
+ yield (0, fixtures_1.expect)(input).not.toBeEditable();
82
+ }));
83
+ (0, fixtures_1.test)("readOnly input has value and can be focused", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
84
+ yield initTestBed(`<NumberBox readOnly="true" initialValue="123" />`);
85
+ const input = page.getByRole("textbox");
86
+ yield (0, fixtures_1.expect)(input).toHaveValue("123");
87
+ yield input.focus();
88
+ yield (0, fixtures_1.expect)(input).toBeFocused();
89
+ }));
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
+ // --- required prop
101
+ (0, fixtures_1.test)("required prop adds required attribute", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
102
+ yield initTestBed(`<NumberBox required="true" />`);
103
+ yield (0, fixtures_1.expect)(page.getByRole("textbox")).toHaveAttribute("required");
104
+ }));
105
+ (0, fixtures_1.test)("empty required NumberBox shows visual indicator", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
106
+ yield initTestBed(`<NumberBox label="test" required="{true}" />`);
107
+ yield (0, fixtures_1.expect)(page.getByText("test")).toContainText("*");
108
+ }));
109
+ // --- autoFocus prop
110
+ (0, fixtures_1.test)("autoFocus focuses input on mount", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
111
+ yield initTestBed(`<NumberBox autoFocus="true" />`);
112
+ yield (0, fixtures_1.expect)(page.getByRole("textbox")).toBeFocused();
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();
117
+ }));
118
+ // --- placeholder prop
119
+ (0, fixtures_1.test)("placeholder shows when input is empty", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
120
+ yield initTestBed(`<NumberBox placeholder="Enter number..." />`);
121
+ yield (0, fixtures_1.expect)(page.getByRole("textbox")).toHaveAttribute("placeholder", "Enter number...");
122
+ }));
123
+ (0, fixtures_1.test)("placeholder does not appear if input is filled", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
124
+ yield initTestBed(`<NumberBox placeholder="placeholder text" initialValue="123" />`);
125
+ yield (0, fixtures_1.expect)(page.getByRole("textbox")).toHaveAttribute("placeholder", "placeholder text");
126
+ yield (0, fixtures_1.expect)(page.getByRole("textbox", { name: "placeholder text" })).toBeVisible();
127
+ }));
128
+ // --- maxLength prop
129
+ (0, fixtures_1.test)("maxLength limits input length", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
130
+ yield initTestBed(`<NumberBox maxLength="3" />`);
131
+ yield page.getByRole("textbox").fill("12345");
132
+ yield (0, fixtures_1.expect)(page.getByRole("textbox")).toHaveValue("123");
133
+ }));
134
+ // --- User input testing
135
+ (0, fixtures_1.test)("component accepts user input", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
136
+ yield initTestBed(`<NumberBox />`);
137
+ yield page.getByRole("textbox").fill("456");
138
+ yield (0, fixtures_1.expect)(page.getByRole("textbox")).toHaveValue("456");
139
+ }));
140
+ (0, fixtures_1.test)("component clears input correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
141
+ yield initTestBed(`<NumberBox initialValue="123" />`);
142
+ const input = page.getByRole("textbox");
143
+ yield (0, fixtures_1.expect)(input).toHaveValue("123");
144
+ yield input.clear();
145
+ yield (0, fixtures_1.expect)(input).toHaveValue("");
146
+ }));
147
+ // --- hasSpinBox prop
148
+ (0, fixtures_1.test)("hasSpinBox=true renders spinbox", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
149
+ yield initTestBed(`<NumberBox hasSpinBox="true" />`);
150
+ // Look for spinner container or buttons
151
+ const spinnerContainer = page.locator(".spinnerBox, .spinner, [class*='spin']").first();
152
+ const spinButtons = page.locator("button");
153
+ const hasSpinnerContainer = yield spinnerContainer.isVisible().catch(() => false);
154
+ const hasSpinButtons = (yield spinButtons.count()) > 0;
155
+ (0, fixtures_1.expect)(hasSpinnerContainer || hasSpinButtons).toBe(true);
156
+ }));
157
+ (0, fixtures_1.test)("hasSpinBox=false hides spinbox", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
158
+ yield initTestBed(`<NumberBox hasSpinBox="false" />`);
159
+ // When hasSpinBox is false, spinner should not be visible
160
+ const spinnerContainer = page.locator(".spinnerBox, .spinner, [class*='spin']").first();
161
+ const spinButtons = page.locator("button");
162
+ const hasSpinnerContainer = yield spinnerContainer.isVisible().catch(() => false);
163
+ const spinButtonCount = yield spinButtons.count();
164
+ (0, fixtures_1.expect)(hasSpinnerContainer).toBe(false);
165
+ (0, fixtures_1.expect)(spinButtonCount).toBe(0);
166
+ }));
167
+ // --- 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, page }) {
169
+ yield initTestBed(`<NumberBox initialValue="5" step="1" />`);
170
+ const incrementButton = page.locator("button").first();
171
+ if (yield incrementButton.isVisible()) {
172
+ yield incrementButton.click();
173
+ yield (0, fixtures_1.expect)(page.getByRole("textbox")).toHaveValue("6");
174
+ }
175
+ }));
176
+ (0, fixtures_1.test)("clicking spinbox down-arrow subtracts step value", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
177
+ yield initTestBed(`<NumberBox initialValue="5" step="1" />`);
178
+ const decrementButton = page.locator("button").nth(1);
179
+ if (yield decrementButton.isVisible()) {
180
+ yield decrementButton.click();
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 }) {
193
+ yield initTestBed(`<NumberBox initialValue="10" step="3.5" />`);
194
+ const incrementButton = page.locator("button").first();
195
+ if (yield incrementButton.isVisible()) {
196
+ yield incrementButton.click();
197
+ yield (0, fixtures_1.expect)(page.getByRole("textbox")).toHaveValue("11");
198
+ }
199
+ }));
200
+ // --- Arrow key navigation
201
+ (0, fixtures_1.test)("pressing up arrow adds step value", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
202
+ yield initTestBed(`<NumberBox initialValue="5" />`);
203
+ const input = page.getByRole("textbox");
204
+ yield input.focus();
205
+ yield page.keyboard.press("ArrowUp");
206
+ yield (0, fixtures_1.expect)(input).toHaveValue("6");
207
+ }));
208
+ (0, fixtures_1.test)("pressing down arrow subtracts step value", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
209
+ yield initTestBed(`<NumberBox initialValue="5" />`);
210
+ const input = page.getByRole("textbox");
211
+ yield input.focus();
212
+ yield page.keyboard.press("ArrowDown");
213
+ yield (0, fixtures_1.expect)(input).toHaveValue("4");
214
+ }));
215
+ // --- integersOnly prop
216
+ (0, fixtures_1.test)("integersOnly=true prevents decimal input", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
217
+ yield initTestBed(`<NumberBox integersOnly="true" />`);
218
+ const input = page.getByRole("textbox");
219
+ yield input.fill("123.45");
220
+ // Should not allow decimal point
221
+ yield (0, fixtures_1.expect)(input).not.toHaveValue("123.45");
222
+ }));
223
+ // --- zeroOrPositive prop
224
+ (0, fixtures_1.test)("zeroOrPositive=true prevents negative values", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
225
+ yield initTestBed(`<NumberBox zeroOrPositive="true" initialValue="5" />`);
226
+ const input = page.getByRole("textbox");
227
+ const decrementButton = page.locator("button").nth(1);
228
+ if (yield decrementButton.isVisible()) {
229
+ // Click multiple times to try to go negative
230
+ for (let i = 0; i < 10; i++) {
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
+ }
237
+ }));
238
+ // --- Range validation (min/max)
239
+ (0, fixtures_1.test)("minValue prevents values below minimum", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
240
+ yield initTestBed(`<NumberBox minValue="10" initialValue="15" />`);
241
+ const decrementButton = page
242
+ .locator("button")
243
+ .filter({ hasText: /decrement|down|\-/ })
244
+ .first();
245
+ if (yield decrementButton.isVisible()) {
246
+ // Click multiple times to try to go below minimum
247
+ for (let i = 0; i < 10; i++) {
248
+ yield decrementButton.click();
249
+ }
250
+ const value = yield page.getByRole("textbox").inputValue();
251
+ (0, fixtures_1.expect)(parseInt(value) || 0).toBeGreaterThanOrEqual(10);
252
+ }
253
+ }));
254
+ (0, fixtures_1.test)("maxValue prevents values above maximum", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
255
+ yield initTestBed(`<NumberBox maxValue="20" initialValue="15" />`);
256
+ const incrementButton = page
257
+ .locator("button")
258
+ .filter({ hasText: /increment|up|\+/ })
259
+ .first();
260
+ if (yield incrementButton.isVisible()) {
261
+ // Click multiple times to try to go above maximum
262
+ for (let i = 0; i < 10; i++) {
263
+ yield incrementButton.click();
264
+ }
265
+ const value = yield page.getByRole("textbox").inputValue();
266
+ (0, fixtures_1.expect)(parseInt(value) || 0).toBeLessThanOrEqual(20);
267
+ }
268
+ }));
269
+ });
270
+ // =============================================================================
271
+ // ACCESSIBILITY TESTS
272
+ // =============================================================================
273
+ fixtures_1.test.describe("Accessibility", () => {
274
+ (0, fixtures_1.test)("has correct role", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
275
+ yield initTestBed(`<NumberBox testId="input" hasSpinBox="true" />`);
276
+ const spinButtons = page.getByTestId("input").locator("button");
277
+ for (let i = 0; i < (yield spinButtons.count()); i++) {
278
+ const button = spinButtons.nth(i);
279
+ yield (0, fixtures_1.expect)(button).toHaveAttribute("role", "spinbutton");
280
+ }
281
+ }));
282
+ (0, fixtures_1.test)("component supports keyboard navigation", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
283
+ yield initTestBed(`<NumberBox label="Amount" />`);
284
+ yield page.keyboard.press("Tab");
285
+ yield (0, fixtures_1.expect)(page.getByRole("textbox")).toBeFocused();
286
+ }));
287
+ (0, fixtures_1.test)("required has proper ARIA attributes", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
288
+ yield initTestBed(`<NumberBox required="true" label="Required field" />`);
289
+ yield (0, fixtures_1.expect)(page.getByRole("textbox")).toHaveAttribute("required");
290
+ }));
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
+ });
308
+ // =============================================================================
309
+ // LABEL POSITIONING TESTS
310
+ // =============================================================================
311
+ fixtures_1.test.describe("Label", () => {
312
+ (0, fixtures_1.test)("component handles invalid labelPosition gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
313
+ yield initTestBed(`<NumberBox label="Label" labelPosition="invalid" />`);
314
+ yield (0, fixtures_1.expect)(page.getByText("Label")).toBeVisible();
315
+ yield (0, fixtures_1.expect)(page.getByRole("textbox")).toBeVisible();
316
+ }));
317
+ (0, fixtures_1.test)("empty string label is not rendered", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
318
+ yield initTestBed(`<NumberBox label="" initialValue="" />`);
319
+ // No specific label should be visible, just the input
320
+ yield (0, fixtures_1.expect)(page.getByRole("textbox")).toBeVisible();
321
+ }));
322
+ (0, fixtures_1.test)("clicking on the label focuses input field", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
323
+ yield initTestBed(`<NumberBox label="Input Field Label" />`);
324
+ yield page.getByText("Input Field Label").click();
325
+ yield (0, fixtures_1.expect)(page.getByRole("textbox")).toBeFocused();
326
+ }));
327
+ (0, fixtures_1.test)("labelPosition=start positions label before input", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
328
+ yield initTestBed(`<NumberBox direction="ltr" label="Label" labelPosition="start" />`);
329
+ const labelBox = yield (0, component_test_helpers_1.getBounds)(page.getByText("Label"));
330
+ const inputBox = yield (0, component_test_helpers_1.getBounds)(page.getByRole("textbox"));
331
+ (0, fixtures_1.expect)(labelBox.right).toBeLessThan(inputBox.left);
332
+ }));
333
+ (0, fixtures_1.test)("labelPosition=end positions label after input", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
334
+ yield initTestBed(`<NumberBox direction="ltr" label="Label" labelPosition="end" />`);
335
+ const labelBox = yield (0, component_test_helpers_1.getBounds)(page.getByText("Label"));
336
+ const inputBox = yield (0, component_test_helpers_1.getBounds)(page.getByRole("textbox"));
337
+ (0, fixtures_1.expect)(labelBox.left).toBeGreaterThan(inputBox.right);
338
+ }));
339
+ (0, fixtures_1.test)("labelPosition=start positions label before input (rtl)", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
340
+ yield initTestBed(`<NumberBox direction="rtl" label="Label" labelPosition="start" />`);
341
+ const labelBox = yield (0, component_test_helpers_1.getBounds)(page.getByText("Label"));
342
+ const inputBox = yield (0, component_test_helpers_1.getBounds)(page.getByRole("textbox"));
343
+ (0, fixtures_1.expect)(labelBox.left).toBeGreaterThan(inputBox.right);
344
+ }));
345
+ (0, fixtures_1.test)("labelPosition=end positions label after input (rtl)", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
346
+ yield initTestBed(`<NumberBox direction="rtl" label="Label" labelPosition="end" />`);
347
+ const labelBox = yield (0, component_test_helpers_1.getBounds)(page.getByText("Label"));
348
+ const inputBox = yield (0, component_test_helpers_1.getBounds)(page.getByRole("textbox"));
349
+ (0, fixtures_1.expect)(labelBox.right).toBeLessThan(inputBox.left);
350
+ }));
351
+ (0, fixtures_1.test)("labelPosition=top positions label above input", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
352
+ yield initTestBed(`<NumberBox label="Label" labelPosition="top" />`);
353
+ const labelBox = yield (0, component_test_helpers_1.getBounds)(page.getByText("Label"));
354
+ const inputBox = yield (0, component_test_helpers_1.getBounds)(page.getByRole("textbox"));
355
+ (0, fixtures_1.expect)(labelBox.bottom).toBeLessThan(inputBox.top);
356
+ }));
357
+ (0, fixtures_1.test)("labelPosition=bottom positions label below input", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
358
+ yield initTestBed(`<NumberBox label="Label" labelPosition="bottom" />`);
359
+ const labelBox = yield (0, component_test_helpers_1.getBounds)(page.getByText("Label"));
360
+ const inputBox = yield (0, component_test_helpers_1.getBounds)(page.getByRole("textbox"));
361
+ (0, fixtures_1.expect)(labelBox.top).toBeGreaterThan(inputBox.bottom);
362
+ }));
363
+ (0, fixtures_1.test)("labelWidth applies custom label width", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
364
+ yield initTestBed(`<NumberBox label="Label" labelWidth="200px" />`);
365
+ const label = page.getByText("Label");
366
+ yield (0, fixtures_1.expect)(label).toBeVisible();
367
+ yield (0, fixtures_1.expect)(label).toHaveCSS("width", "200px");
368
+ }));
369
+ (0, fixtures_1.test)("labelBreak enables label line breaks", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
370
+ yield initTestBed(`<NumberBox label="Very long label text" labelBreak="true" labelWidth="50px" />`);
371
+ const label = page.getByText("Very long label text");
372
+ yield (0, fixtures_1.expect)(label).toBeVisible();
373
+ }));
374
+ });
375
+ // =============================================================================
376
+ // EVENT HANDLING TESTS
377
+ // =============================================================================
378
+ fixtures_1.test.describe("Event Handling", () => {
379
+ (0, fixtures_1.test)("didChange event fires on input change", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
380
+ const { testStateDriver } = yield initTestBed(`<NumberBox onDidChange="testState = 'changed'" />`);
381
+ yield page.getByRole("textbox").fill("123");
382
+ yield fixtures_1.expect.poll(testStateDriver.testState).toBe("changed");
383
+ }));
384
+ (0, fixtures_1.test)("didChange event passes new value", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
385
+ const { testStateDriver } = yield initTestBed(`<NumberBox onDidChange="arg => testState = arg" />`);
386
+ yield page.getByRole("textbox").fill("123");
387
+ yield fixtures_1.expect.poll(testStateDriver.testState).toBe("123");
388
+ }));
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
+ (0, fixtures_1.test)("gotFocus event fires on focus", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
400
+ const { testStateDriver } = yield initTestBed(`<NumberBox onGotFocus="testState = 'focused'" />`);
401
+ yield page.getByRole("textbox").focus();
402
+ yield fixtures_1.expect.poll(testStateDriver.testState).toBe("focused");
403
+ }));
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
+ (0, fixtures_1.test)("lostFocus event fires on blur", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
411
+ const { testStateDriver } = yield initTestBed(`<NumberBox onLostFocus="testState = 'blurred'" />`);
412
+ const input = page.getByRole("textbox");
413
+ yield input.focus();
414
+ yield input.blur();
415
+ yield fixtures_1.expect.poll(testStateDriver.testState).toBe("blurred");
416
+ }));
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
+ (0, fixtures_1.test)("events do not fire when component is disabled", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
426
+ const { testStateDriver } = yield initTestBed(`
427
+ <NumberBox enabled="false" onDidChange="testState = 'changed'" onGotFocus="testState = 'focused'" />
428
+ `);
429
+ const input = page.getByRole("textbox");
430
+ yield input.focus();
431
+ yield input.fill("123", { force: true }); // Should not allow input
432
+ yield fixtures_1.expect.poll(testStateDriver.testState).toBe(null);
433
+ }));
434
+ });
435
+ // =============================================================================
436
+ // API TESTS
437
+ // =============================================================================
438
+ fixtures_1.test.describe("API", () => {
439
+ (0, fixtures_1.test)("value API returns current state", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
440
+ const { testStateDriver } = yield initTestBed(`
441
+ <Fragment>
442
+ <NumberBox id="numberbox" initialValue="123" />
443
+ <Button label="test" onClick="testState = numberbox.value" />
444
+ </Fragment>
445
+ `);
446
+ yield page.getByRole("button", { name: "test" }).click();
447
+ yield fixtures_1.expect.poll(testStateDriver.testState).toBe(123);
448
+ }));
449
+ (0, fixtures_1.test)("value API returns state after change", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
450
+ const { testStateDriver } = yield initTestBed(`
451
+ <Fragment>
452
+ <NumberBox id="numberbox" />
453
+ <Button label="test" onClick="testState = numberbox.value" />
454
+ </Fragment>
455
+ `);
456
+ yield page.getByRole("textbox").fill("456");
457
+ yield page.getByRole("button", { name: "test" }).click();
458
+ yield fixtures_1.expect.poll(testStateDriver.testState).toBe("456");
459
+ }));
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
+ (0, fixtures_1.test)("setValue API updates state", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
470
+ yield initTestBed(`
471
+ <Fragment>
472
+ <NumberBox id="numberbox" />
473
+ <Button label="test" onClick="numberbox.setValue(789)" />
474
+ </Fragment>
475
+ `);
476
+ yield page.getByRole("button", { name: "test" }).click();
477
+ yield (0, fixtures_1.expect)(page.getByRole("textbox")).toHaveValue("789");
478
+ }));
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
+ (0, fixtures_1.test)("setValue API triggers events", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
489
+ const { testStateDriver } = yield initTestBed(`
490
+ <Fragment>
491
+ <NumberBox id="numberbox" onDidChange="testState = 'changed'" />
492
+ <Button label="test" onClick="numberbox.setValue(123)" />
493
+ </Fragment>
494
+ `);
495
+ yield page.getByRole("button", { name: "test" }).click();
496
+ yield fixtures_1.expect.poll(testStateDriver.testState).toBe("changed");
497
+ }));
498
+ (0, fixtures_1.test)("focus API focuses the input", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
499
+ yield initTestBed(`
500
+ <Fragment>
501
+ <NumberBox id="numberbox" />
502
+ <Button label="test" onClick="numberbox.focus()" />
503
+ </Fragment>
504
+ `);
505
+ yield page.getByRole("button", { name: "test" }).click();
506
+ yield (0, fixtures_1.expect)(page.getByRole("textbox")).toBeFocused();
507
+ }));
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
+ (0, fixtures_1.test)("focus API does nothing when component is disabled", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
518
+ yield initTestBed(`
519
+ <Fragment>
520
+ <NumberBox id="numberbox" enabled="false" />
521
+ <Button label="test" onClick="numberbox.focus()" />
522
+ </Fragment>
523
+ `);
524
+ yield page.getByRole("button", { name: "test" }).click();
525
+ yield (0, fixtures_1.expect)(page.getByRole("textbox")).not.toBeFocused();
526
+ }));
527
+ });
528
+ // =============================================================================
529
+ // INPUT ADORNMENTS TESTS (From TextBox pattern)
530
+ // =============================================================================
531
+ fixtures_1.test.describe("Input Adornments", () => {
532
+ (0, fixtures_1.test)("startText displays at beginning of input", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
533
+ yield initTestBed(`<NumberBox testId="input" direction="ltr" startText="$" />`);
534
+ const { left: compLeft, right: compRight } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("input"));
535
+ const { left: textLeft, right: textRight } = yield (0, component_test_helpers_1.getBounds)(page.getByText("$"));
536
+ yield (0, fixtures_1.expect)(page.getByTestId("input")).toContainText("$");
537
+ (0, fixtures_1.expect)(textRight - compLeft).toBeLessThanOrEqual(compRight - textLeft);
538
+ }));
539
+ (0, fixtures_1.test)("startText displays at beginning of input (rtl)", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
540
+ yield initTestBed(`<NumberBox testId="input" direction="rtl" startText="$" />`);
541
+ const { left: compLeft, right: compRight } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("input"));
542
+ const { left: textLeft, right: textRight } = yield (0, component_test_helpers_1.getBounds)(page.getByText("$"));
543
+ yield (0, fixtures_1.expect)(page.getByTestId("input")).toContainText("$");
544
+ (0, fixtures_1.expect)(textRight - compLeft).toBeGreaterThanOrEqual(compRight - textLeft);
545
+ }));
546
+ (0, fixtures_1.test)("endText displays at end of input", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
547
+ yield initTestBed(`<NumberBox testId="input" direction="ltr" endText="USD" />`);
548
+ const { left: compLeft, right: compRight } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("input"));
549
+ const { left: textLeft, right: textRight } = yield (0, component_test_helpers_1.getBounds)(page.getByText("USD"));
550
+ yield (0, fixtures_1.expect)(page.getByTestId("input")).toContainText("USD");
551
+ (0, fixtures_1.expect)(textRight - compLeft).toBeGreaterThanOrEqual(compRight - textLeft);
552
+ }));
553
+ (0, fixtures_1.test)("endText displays at end of input (rtl)", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
554
+ yield initTestBed(`<NumberBox testId="input" direction="rtl" endText="USD" />`);
555
+ const { left: compLeft, right: compRight } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("input"));
556
+ const { left: textLeft, right: textRight } = yield (0, component_test_helpers_1.getBounds)(page.getByText("USD"));
557
+ yield (0, fixtures_1.expect)(page.getByTestId("input")).toContainText("USD");
558
+ (0, fixtures_1.expect)(textRight - compLeft).toBeLessThanOrEqual(compRight - textLeft);
559
+ }));
560
+ (0, fixtures_1.test)("startIcon displays at beginning of input", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
561
+ yield initTestBed(`<NumberBox testId="input" direction="ltr" startIcon="search" />`);
562
+ const { left: compLeft, right: compRight } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("input"));
563
+ const { left: iconLeft, right: iconRight } = yield (0, component_test_helpers_1.getBounds)(page.getByRole("img").first());
564
+ (0, fixtures_1.expect)(iconRight - compLeft).toBeLessThanOrEqual(compRight - iconLeft);
565
+ }));
566
+ (0, fixtures_1.test)("startIcon displays at beginning of input (rtl)", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
567
+ yield initTestBed(`<NumberBox testId="input" direction="rtl" startIcon="search" />`);
568
+ const { left: compLeft, right: compRight } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("input"));
569
+ const { left: iconLeft, right: iconRight } = yield (0, component_test_helpers_1.getBounds)(page.getByRole("img").first());
570
+ (0, fixtures_1.expect)(iconRight - compLeft).toBeGreaterThanOrEqual(compRight - iconLeft);
571
+ }));
572
+ (0, fixtures_1.test)("endIcon displays at end of input", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
573
+ yield initTestBed(`<NumberBox testId="input" endIcon="search" />`);
574
+ const { left: compLeft, right: compRight } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("input"));
575
+ const { left: iconLeft, right: iconRight } = yield (0, component_test_helpers_1.getBounds)(page.getByRole("img").first());
576
+ (0, fixtures_1.expect)(iconRight - compLeft).toBeGreaterThanOrEqual(compRight - iconLeft);
577
+ }));
578
+ (0, fixtures_1.test)("endIcon displays at end of input (rtl)", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
579
+ yield initTestBed(`<NumberBox testId="input" direction="rtl" endIcon="search" />`);
580
+ const { left: compLeft, right: compRight } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("input"));
581
+ const { left: iconLeft, right: iconRight } = yield (0, component_test_helpers_1.getBounds)(page.getByRole("img").first());
582
+ (0, fixtures_1.expect)(iconRight - compLeft).toBeLessThanOrEqual(compRight - iconLeft);
583
+ }));
584
+ (0, fixtures_1.test)("multiple adornments can be combined", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
585
+ yield initTestBed(`
586
+ <NumberBox testId="input" startText="$" endText="USD" startIcon="search" endIcon="search" />
587
+ `);
588
+ yield (0, fixtures_1.expect)(page.getByTestId("input")).toContainText("$");
589
+ yield (0, fixtures_1.expect)(page.getByTestId("input")).toContainText("USD");
590
+ yield (0, fixtures_1.expect)(page.getByRole("img").first()).toBeVisible();
591
+ yield (0, fixtures_1.expect)(page.getByRole("img").nth(1)).toBeVisible();
592
+ }));
593
+ (0, fixtures_1.test)("all adornments appear in the right place", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
594
+ yield initTestBed(`
595
+ <NumberBox testId="input" startText="$" endText="USD" startIcon="search" endIcon="search" direction="ltr" />
596
+ `);
597
+ const { left: compLeft, right: compRight } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("input"));
598
+ const { left: startTextLeft, right: startTextRight } = yield (0, component_test_helpers_1.getBounds)(page.getByText("$"));
599
+ const { left: endTextLeft, right: endTextRight } = yield (0, component_test_helpers_1.getBounds)(page.getByText("USD"));
600
+ const { left: startIconLeft, right: startIconRight } = yield (0, component_test_helpers_1.getBounds)(page.getByRole("img").first());
601
+ const { left: endIconLeft, right: endIconRight } = yield (0, component_test_helpers_1.getBounds)(page.getByRole("img").nth(1));
602
+ // Check order of adornments
603
+ (0, fixtures_1.expect)(startTextRight - compLeft).toBeLessThanOrEqual(compRight - startTextLeft);
604
+ (0, fixtures_1.expect)(startIconRight - compLeft).toBeLessThanOrEqual(compRight - startIconLeft);
605
+ (0, fixtures_1.expect)(endTextRight - compLeft).toBeGreaterThanOrEqual(compRight - endTextLeft);
606
+ (0, fixtures_1.expect)(endIconRight - compLeft).toBeGreaterThanOrEqual(compRight - endIconLeft);
607
+ }));
608
+ });
609
+ // =============================================================================
610
+ // THEME VARIABLE TESTS
611
+ // =============================================================================
612
+ fixtures_1.test.describe("Theme Variables", () => {
613
+ (0, fixtures_1.test)("backgroundColor applies correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
614
+ yield initTestBed(`<NumberBox testId="input" />`, {
615
+ testThemeVars: { "backgroundColor-NumberBox-default": "rgb(255, 0, 0)" },
616
+ });
617
+ yield (0, fixtures_1.expect)(page.getByTestId("input")).toHaveCSS("background-color", "rgb(255, 0, 0)");
618
+ }));
619
+ (0, fixtures_1.test)("borderColor applies correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
620
+ yield initTestBed(`<NumberBox testId="input" />`, {
621
+ testThemeVars: { "borderColor-NumberBox-default": "rgb(0, 255, 0)" },
622
+ });
623
+ yield (0, fixtures_1.expect)(page.getByTestId("input")).toHaveCSS("border-color", "rgb(0, 255, 0)");
624
+ }));
625
+ (0, fixtures_1.test)("textColor applies correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
626
+ yield initTestBed(`<NumberBox testId="input" />`, {
627
+ testThemeVars: { "textColor-NumberBox-default": "rgb(0, 0, 255)" },
628
+ });
629
+ yield (0, fixtures_1.expect)(page.getByTestId("input")).toHaveCSS("color", "rgb(0, 0, 255)");
630
+ }));
631
+ (0, fixtures_1.test)("focus borderColor applies on focus", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
632
+ yield initTestBed(`<NumberBox testId="input" />`, {
633
+ testThemeVars: { "borderColor-NumberBox-default--focus": "rgb(255, 255, 0)" },
634
+ });
635
+ yield page.getByRole("textbox").focus();
636
+ yield (0, fixtures_1.expect)(page.getByTestId("input")).toHaveCSS("border-color", "rgb(255, 255, 0)");
637
+ }));
638
+ (0, fixtures_1.test)("disabled backgroundColor applies when disabled", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
639
+ yield initTestBed(`<NumberBox testId="input" enabled="false" />`, {
640
+ testThemeVars: { "backgroundColor-NumberBox--disabled": "rgb(128, 128, 128)" },
641
+ });
642
+ yield (0, fixtures_1.expect)(page.getByTestId("input")).toHaveCSS("background-color", "rgb(128, 128, 128)");
643
+ }));
644
+ (0, fixtures_1.test)("borderRadius applies correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
645
+ yield initTestBed(`<NumberBox testId="input" />`, {
646
+ testThemeVars: { "borderRadius-NumberBox-default": "10px" },
647
+ });
648
+ yield (0, fixtures_1.expect)(page.getByTestId("input")).toHaveCSS("border-radius", "10px");
649
+ }));
650
+ (0, fixtures_1.test)("padding applies correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
651
+ yield initTestBed(`<NumberBox testId="input" />`, {
652
+ testThemeVars: { "padding-NumberBox": "15px" },
653
+ });
654
+ yield (0, fixtures_1.expect)(page.getByTestId("input")).toHaveCSS("padding", "15px");
655
+ }));
656
+ // Additional variant mixin theme variable tests
657
+ (0, fixtures_1.test)("borderWidth applies correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
658
+ yield initTestBed(`<NumberBox testId="input" />`, {
659
+ testThemeVars: { "borderWidth-NumberBox-default": "3px" },
660
+ });
661
+ yield (0, fixtures_1.expect)(page.getByTestId("input")).toHaveCSS("border-width", "3px");
662
+ }));
663
+ (0, fixtures_1.test)("borderStyle applies correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
664
+ yield initTestBed(`<NumberBox testId="input" />`, {
665
+ testThemeVars: { "borderStyle-NumberBox-default": "dashed" },
666
+ });
667
+ yield (0, fixtures_1.expect)(page.getByTestId("input")).toHaveCSS("border-style", "dashed");
668
+ }));
669
+ (0, fixtures_1.test)("fontSize applies correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
670
+ yield initTestBed(`<NumberBox testId="input" />`, {
671
+ testThemeVars: { "fontSize-NumberBox-default": "18px" },
672
+ });
673
+ yield (0, fixtures_1.expect)(page.getByTestId("input")).toHaveCSS("font-size", "18px");
674
+ }));
675
+ (0, fixtures_1.test)("boxShadow applies correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
676
+ yield initTestBed(`<NumberBox testId="input" />`, {
677
+ testThemeVars: { "boxShadow-NumberBox-default": "rgba(0, 0, 0, 0.2) 0px 2px 4px 0px" },
678
+ });
679
+ yield (0, fixtures_1.expect)(page.getByTestId("input")).toHaveCSS("box-shadow", "rgba(0, 0, 0, 0.2) 0px 2px 4px 0px");
680
+ }));
681
+ (0, fixtures_1.test)("hover borderColor applies on hover", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
682
+ yield initTestBed(`<NumberBox testId="input" />`, {
683
+ testThemeVars: { "borderColor-NumberBox-default--hover": "rgb(255, 100, 100)" },
684
+ });
685
+ yield page.getByTestId("input").hover();
686
+ yield (0, fixtures_1.expect)(page.getByTestId("input")).toHaveCSS("border-color", "rgb(255, 100, 100)");
687
+ }));
688
+ (0, fixtures_1.test)("hover backgroundColor applies on hover", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
689
+ yield initTestBed(`<NumberBox testId="input" />`, {
690
+ testThemeVars: { "backgroundColor-NumberBox-default--hover": "rgb(240, 240, 240)" },
691
+ });
692
+ yield page.getByTestId("input").hover();
693
+ yield (0, fixtures_1.expect)(page.getByTestId("input")).toHaveCSS("background-color", "rgb(240, 240, 240)");
694
+ }));
695
+ (0, fixtures_1.test)("hover boxShadow applies on hover", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
696
+ yield initTestBed(`<NumberBox testId="input" />`, {
697
+ testThemeVars: { "boxShadow-NumberBox-default--hover": "rgba(0, 0, 0, 0.3) 0px 4px 8px 0px" },
698
+ });
699
+ yield page.getByTestId("input").hover();
700
+ yield (0, fixtures_1.expect)(page.getByTestId("input")).toHaveCSS("box-shadow", "rgba(0, 0, 0, 0.3) 0px 4px 8px 0px");
701
+ }));
702
+ (0, fixtures_1.test)("hover textColor applies on hover", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
703
+ yield initTestBed(`<NumberBox testId="input" />`, {
704
+ testThemeVars: { "textColor-NumberBox-default--hover": "rgb(50, 50, 50)" },
705
+ });
706
+ yield page.getByTestId("input").hover();
707
+ yield (0, fixtures_1.expect)(page.getByTestId("input")).toHaveCSS("color", "rgb(50, 50, 50)");
708
+ }));
709
+ (0, fixtures_1.test)("focus backgroundColor applies on focus", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
710
+ yield initTestBed(`<NumberBox testId="input" />`, {
711
+ testThemeVars: { "backgroundColor-NumberBox-default--focus": "rgb(250, 250, 250)" },
712
+ });
713
+ yield page.getByRole("textbox").focus();
714
+ yield (0, fixtures_1.expect)(page.getByTestId("input")).toHaveCSS("background-color", "rgb(250, 250, 250)");
715
+ }));
716
+ (0, fixtures_1.test)("focus boxShadow applies on focus", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
717
+ yield initTestBed(`<NumberBox testId="input" />`, {
718
+ testThemeVars: {
719
+ "boxShadow-NumberBox-default--focus": "rgba(0, 100, 255, 0.4) 0px 0px 0px 3px",
720
+ },
721
+ });
722
+ yield page.getByRole("textbox").focus();
723
+ yield (0, fixtures_1.expect)(page.getByTestId("input")).toHaveCSS("box-shadow", "rgba(0, 100, 255, 0.4) 0px 0px 0px 3px");
724
+ }));
725
+ (0, fixtures_1.test)("focus textColor applies on focus", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
726
+ yield initTestBed(`<NumberBox testId="input" />`, {
727
+ testThemeVars: { "textColor-NumberBox-default--focus": "rgb(20, 20, 20)" },
728
+ });
729
+ yield page.getByRole("textbox").focus();
730
+ yield (0, fixtures_1.expect)(page.getByTestId("input")).toHaveCSS("color", "rgb(20, 20, 20)");
731
+ }));
732
+ (0, fixtures_1.test)("focus outline properties apply on focus", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
733
+ yield initTestBed(`<NumberBox testId="input" />`, {
734
+ testThemeVars: {
735
+ "outlineWidth-NumberBox-default--focus": "2px",
736
+ "outlineColor-NumberBox-default--focus": "rgb(0, 123, 255)",
737
+ "outlineStyle-NumberBox-default--focus": "solid",
738
+ "outlineOffset-NumberBox-default--focus": "2px",
739
+ },
740
+ });
741
+ yield page.getByRole("textbox").focus();
742
+ yield (0, fixtures_1.expect)(page.getByTestId("input")).toHaveCSS("outline-width", "2px");
743
+ yield (0, fixtures_1.expect)(page.getByTestId("input")).toHaveCSS("outline-color", "rgb(0, 123, 255)");
744
+ yield (0, fixtures_1.expect)(page.getByTestId("input")).toHaveCSS("outline-style", "solid");
745
+ yield (0, fixtures_1.expect)(page.getByTestId("input")).toHaveCSS("outline-offset", "2px");
746
+ }));
747
+ (0, fixtures_1.test)("placeholder textColor applies correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
748
+ yield initTestBed(`<NumberBox testId="input" placeholder="Enter number" />`, {
749
+ testThemeVars: { "textColor-placeholder-NumberBox-default": "rgb(150, 150, 150)" },
750
+ });
751
+ const input = page.getByRole("textbox");
752
+ const placeholderColor = yield input.evaluate((el) => {
753
+ return window.getComputedStyle(el, "::placeholder").color;
754
+ });
755
+ (0, fixtures_1.expect)(placeholderColor).toBe("rgb(150, 150, 150)");
756
+ }));
757
+ (0, fixtures_1.test)("placeholder fontSize applies correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
758
+ yield initTestBed(`<NumberBox testId="input" placeholder="Enter number" />`, {
759
+ testThemeVars: { "fontSize-placeholder-NumberBox-default": "14px" },
760
+ });
761
+ const input = page.getByRole("textbox");
762
+ const placeholderFontSize = yield input.evaluate((el) => {
763
+ return window.getComputedStyle(el, "::placeholder").fontSize;
764
+ });
765
+ (0, fixtures_1.expect)(placeholderFontSize).toBe("14px");
766
+ }));
767
+ (0, fixtures_1.test)("gap between adornments applies correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
768
+ yield initTestBed(`<NumberBox testId="input" startText="$" endText="USD" />`, {
769
+ testThemeVars: { "gap-adornment-NumberBox": "8px" },
770
+ });
771
+ yield (0, fixtures_1.expect)(page.getByTestId("input")).toHaveCSS("gap", "8px");
772
+ }));
773
+ (0, fixtures_1.test)("disabled textColor applies when disabled", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
774
+ yield initTestBed(`<NumberBox testId="input" enabled="false" />`, {
775
+ testThemeVars: { "textColor-NumberBox--disabled": "rgb(160, 160, 160)" },
776
+ });
777
+ yield (0, fixtures_1.expect)(page.getByTestId("input")).toHaveCSS("color", "rgb(160, 160, 160)");
778
+ }));
779
+ (0, fixtures_1.test)("disabled borderColor applies when disabled", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
780
+ yield initTestBed(`<NumberBox testId="input" enabled="false" />`, {
781
+ testThemeVars: { "borderColor-NumberBox--disabled": "rgb(200, 200, 200)" },
782
+ });
783
+ yield (0, fixtures_1.expect)(page.getByTestId("input")).toHaveCSS("border-color", "rgb(200, 200, 200)");
784
+ }));
785
+ // Error variant theme variables
786
+ (0, fixtures_1.test)("error variant borderRadius applies correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
787
+ yield initTestBed(`<NumberBox testId="input" validationStatus="error" />`, {
788
+ testThemeVars: { "borderRadius-NumberBox-error": "8px" },
789
+ });
790
+ yield (0, fixtures_1.expect)(page.getByTestId("input")).toHaveCSS("border-radius", "8px");
791
+ }));
792
+ (0, fixtures_1.test)("error variant fontSize applies correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
793
+ yield initTestBed(`<NumberBox testId="input" validationStatus="error" />`, {
794
+ testThemeVars: { "fontSize-NumberBox-error": "16px" },
795
+ });
796
+ yield (0, fixtures_1.expect)(page.getByTestId("input")).toHaveCSS("font-size", "16px");
797
+ }));
798
+ (0, fixtures_1.test)("error variant backgroundColor applies correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
799
+ yield initTestBed(`<NumberBox testId="input" validationStatus="error" />`, {
800
+ testThemeVars: { "backgroundColor-NumberBox-error": "rgb(255, 240, 240)" },
801
+ });
802
+ yield (0, fixtures_1.expect)(page.getByTestId("input")).toHaveCSS("background-color", "rgb(255, 240, 240)");
803
+ }));
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
+ (0, fixtures_1.test)("warning variant textColor applies correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
812
+ yield initTestBed(`<NumberBox testId="input" validationStatus="warning" />`, {
813
+ testThemeVars: { "textColor-NumberBox-warning": "rgb(133, 100, 4)" },
814
+ });
815
+ yield (0, fixtures_1.expect)(page.getByTestId("input")).toHaveCSS("color", "rgb(133, 100, 4)");
816
+ }));
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
+ (0, fixtures_1.test)("success variant backgroundColor applies correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
825
+ yield initTestBed(`<NumberBox testId="input" validationStatus="valid" />`, {
826
+ testThemeVars: { "backgroundColor-NumberBox-success": "rgb(240, 255, 240)" },
827
+ });
828
+ yield (0, fixtures_1.expect)(page.getByTestId("input")).toHaveCSS("background-color", "rgb(240, 255, 240)");
829
+ }));
830
+ (0, fixtures_1.test)("input text adornment colors apply correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
831
+ yield initTestBed(`<NumberBox testId="input" startText="$" endText="€" />`, {
832
+ testThemeVars: { "color-adornment-NumberBox-default": "rgb(0, 123, 255)" },
833
+ });
834
+ yield (0, fixtures_1.expect)(page.getByText("$")).toHaveCSS("color", "rgb(0, 123, 255)");
835
+ yield (0, fixtures_1.expect)(page.getByText("€")).toHaveCSS("color", "rgb(0, 123, 255)");
836
+ }));
837
+ (0, fixtures_1.test)("input icon adornment colors apply correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
838
+ yield initTestBed(`<NumberBox testId="input" startIcon="search" endIcon="search" />`, {
839
+ testThemeVars: { "color-adornment-NumberBox-default": "rgb(0, 123, 255)" },
840
+ });
841
+ yield (0, fixtures_1.expect)(page.getByRole("img").first()).toHaveCSS("color", "rgb(0, 123, 255)");
842
+ yield (0, fixtures_1.expect)(page.getByRole("img").nth(1)).toHaveCSS("color", "rgb(0, 123, 255)");
843
+ }));
844
+ });
845
+ // =============================================================================
846
+ // VALIDATION STATUS TESTS
847
+ // =============================================================================
848
+ fixtures_1.test.describe("Validation", () => {
849
+ (0, fixtures_1.test)("error borderColor applies with error validation", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
850
+ yield initTestBed(`<NumberBox testId="input" validationStatus="error" />`, {
851
+ testThemeVars: { "borderColor-NumberBox-error": "rgb(255, 0, 0)" },
852
+ });
853
+ yield (0, fixtures_1.expect)(page.getByTestId("input")).toHaveCSS("border-color", "rgb(255, 0, 0)");
854
+ }));
855
+ (0, fixtures_1.test)("warning borderColor applies with warning validation", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
856
+ yield initTestBed(`<NumberBox testId="input" validationStatus="warning" />`, {
857
+ testThemeVars: { "borderColor-NumberBox-warning": "rgb(255, 165, 0)" },
858
+ });
859
+ yield (0, fixtures_1.expect)(page.getByTestId("input")).toHaveCSS("border-color", "rgb(255, 165, 0)");
860
+ }));
861
+ (0, fixtures_1.test)("success borderColor applies with valid validation", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
862
+ yield initTestBed(`<NumberBox testId="input" validationStatus="valid" />`, {
863
+ testThemeVars: { "borderColor-NumberBox-success": "rgb(0, 128, 0)" },
864
+ });
865
+ yield (0, fixtures_1.expect)(page.getByTestId("input")).toHaveCSS("border-color", "rgb(0, 128, 0)");
866
+ }));
867
+ (0, fixtures_1.test)("handles invalid validationStatus gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
868
+ yield initTestBed(`<NumberBox testId="input" validationStatus="invalid-status" />`, {
869
+ testThemeVars: {
870
+ "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
+ },
875
+ });
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
+ yield (0, fixtures_1.expect)(page.getByTestId("input")).toHaveCSS("border-color", "rgb(0, 0, 0)");
880
+ }));
881
+ });
882
+ // =============================================================================
883
+ // OTHER EDGE CASE TESTS
884
+ // =============================================================================
885
+ fixtures_1.test.describe("Other Edge Cases", () => {
886
+ (0, fixtures_1.test)("placeholder is hidden if input field is filled", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
887
+ yield initTestBed(`<NumberBox placeholder="123" />`);
888
+ const input = page.getByRole("textbox");
889
+ yield input.fill("456");
890
+ yield (0, fixtures_1.expect)(input).toHaveValue("456");
891
+ yield (0, fixtures_1.expect)(input).toHaveAttribute("placeholder", "123");
892
+ }));
893
+ (0, fixtures_1.test)("invalid initialValue types are handled gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
894
+ // Test various invalid types
895
+ yield initTestBed(`<NumberBox initialValue="{true}" />`);
896
+ yield (0, fixtures_1.expect)(page.getByRole("textbox")).toHaveValue("");
897
+ }));
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
+ // Complex edge cases
1049
+ (0, fixtures_1.test)("handle special characters in input", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
1050
+ yield initTestBed(`<NumberBox />`);
1051
+ const input = page.getByRole("textbox");
1052
+ // Should filter out special characters
1053
+ yield input.fill("!@#$123%^&");
1054
+ yield (0, fixtures_1.expect)(input).not.toHaveValue("!@#$123%^&");
1055
+ }));
1056
+ (0, fixtures_1.test)("handle Unicode characters in input", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
1057
+ yield initTestBed(`<NumberBox />`);
1058
+ const input = page.getByRole("textbox");
1059
+ // Should filter out Unicode characters
1060
+ yield input.fill("👨‍👩‍👧‍👦123");
1061
+ yield (0, fixtures_1.expect)(input).not.toHaveValue("👨‍👩‍👧‍👦123");
1062
+ }));
1063
+ (0, fixtures_1.test)("component handles very long input text", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
1064
+ yield initTestBed(`<NumberBox />`);
1065
+ const input = page.getByRole("textbox");
1066
+ const longNumber = "1".repeat(100);
1067
+ yield input.fill(longNumber);
1068
+ // Should handle or truncate appropriately
1069
+ yield (0, fixtures_1.expect)(input).toBeVisible();
1070
+ }));
1071
+ (0, fixtures_1.test)("component handles rapid input changes", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
1072
+ yield initTestBed(`<NumberBox />`);
1073
+ const input = page.getByRole("textbox");
1074
+ yield input.pressSequentially("123", { delay: 50 });
1075
+ yield (0, fixtures_1.expect)(input).toHaveValue("123");
1076
+ yield input.clear();
1077
+ yield input.pressSequentially("456", { delay: 25 });
1078
+ yield (0, fixtures_1.expect)(input).toHaveValue("456");
1079
+ }));
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
+ (0, fixtures_1.test)("component works with conditional rendering", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
1096
+ yield initTestBed(`
1097
+ <Fragment>
1098
+ <NumberBox when="{testState}" />
1099
+ <Button label="test" onClick="testState = true" />
1100
+ </Fragment>
1101
+ `);
1102
+ // Initially not visible
1103
+ yield (0, fixtures_1.expect)(page.getByRole("textbox")).not.toBeVisible();
1104
+ // Click to show
1105
+ yield page.getByRole("button", { name: "test" }).click();
1106
+ yield (0, fixtures_1.expect)(page.getByRole("textbox")).toBeVisible();
1107
+ }));
1108
+ (0, fixtures_1.test)("spinner buttons work with long press", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
1109
+ yield initTestBed(`<NumberBox initialValue="0" />`);
1110
+ const incrementButton = page
1111
+ .locator("button")
1112
+ .filter({ hasText: /increment|up|\+/ })
1113
+ .first();
1114
+ if (yield incrementButton.isVisible()) {
1115
+ // Hold down the button (simulate long press)
1116
+ yield incrementButton.hover();
1117
+ yield page.mouse.down();
1118
+ yield page.waitForTimeout(600); // Wait longer than initial delay
1119
+ yield page.mouse.up();
1120
+ // Should have incremented multiple times
1121
+ const value = yield page.getByRole("textbox").inputValue();
1122
+ (0, fixtures_1.expect)(parseInt(value) || 0).toBeGreaterThan(1);
1123
+ }
1124
+ }));
1125
+ (0, fixtures_1.test)("readOnly disables spinner buttons", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
1126
+ yield initTestBed(`<NumberBox readOnly="true" initialValue="5" />`);
1127
+ const incrementButton = page
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
1154
+ }));
1155
+ // Special numeric formats
1156
+ (0, fixtures_1.test)("handle special numeric input formats", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
1157
+ yield initTestBed(`<NumberBox />`);
1158
+ const input = page.getByRole("textbox");
1159
+ // Test scientific notation
1160
+ yield input.fill("1e5");
1161
+ yield (0, fixtures_1.expect)(input).toHaveValue("1e5");
1162
+ // Test negative numbers
1163
+ yield input.clear();
1164
+ yield input.fill("-123");
1165
+ yield (0, fixtures_1.expect)(input).toHaveValue("-123");
1166
+ }));
1167
+ (0, fixtures_1.test)("entering multiple 0s only results in one 0", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
1168
+ yield initTestBed(`<NumberBox />`);
1169
+ yield page.getByRole("textbox").pressSequentially("0000000000000000");
1170
+ yield page.getByRole("textbox").blur();
1171
+ yield (0, fixtures_1.expect)(page.getByRole("textbox")).toHaveValue("0");
1172
+ }));
1173
+ (0, fixtures_1.test)("copying multiple 0s only results in one 0", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
1174
+ const { clipboard } = yield initTestBed(`<NumberBox />`);
1175
+ yield clipboard.write("0000000000000000");
1176
+ yield clipboard.paste(page.getByRole("textbox"));
1177
+ yield page.getByRole("textbox").blur();
1178
+ yield (0, fixtures_1.expect)(page.getByRole("textbox")).toHaveValue("0");
1179
+ }));
1180
+ (0, fixtures_1.test)("standalone minus sign is permitted if field is not blurred yet", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, }) {
1181
+ yield initTestBed(`<NumberBox />`);
1182
+ yield page.getByRole("textbox").fill("-");
1183
+ yield (0, fixtures_1.expect)(page.getByRole("textbox")).toHaveValue("-");
1184
+ }));
1185
+ (0, fixtures_1.test)("minus sign is applied correctly if it comes after number", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, }) {
1186
+ yield initTestBed(`<NumberBox />`);
1187
+ yield page.getByRole("textbox").pressSequentially("123-");
1188
+ yield (0, fixtures_1.expect)(page.getByRole("textbox")).toHaveValue("-123");
1189
+ }));
1190
+ (0, fixtures_1.test)("placing decimal separator between the numbers of an integer results in a float", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, }) {
1191
+ yield initTestBed(`<NumberBox />`);
1192
+ const input = page.getByRole("textbox");
1193
+ yield input.fill("123456");
1194
+ yield input.press("ArrowLeft");
1195
+ yield input.press("ArrowLeft");
1196
+ yield input.press("ArrowLeft");
1197
+ yield input.press(".");
1198
+ yield (0, fixtures_1.expect)(input).toHaveValue("123.456");
1199
+ }));
1200
+ (0, fixtures_1.test)("placing second decimal separator is not permitted", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
1201
+ yield initTestBed(`<NumberBox />`);
1202
+ const input = page.getByRole("textbox");
1203
+ yield input.fill("1.23456");
1204
+ yield input.press("ArrowLeft");
1205
+ yield input.press(".");
1206
+ yield (0, fixtures_1.expect)(input).toHaveValue("1.23456");
1207
+ }));
1208
+ (0, fixtures_1.test)("placing decimal separator before an integer adds a leading 0 (#1)", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, }) {
1209
+ yield initTestBed(`<NumberBox />`);
1210
+ const input = page.getByRole("textbox");
1211
+ yield input.fill("12");
1212
+ yield input.press("ArrowLeft");
1213
+ yield input.press("ArrowLeft");
1214
+ yield input.press(".");
1215
+ yield (0, fixtures_1.expect)(input).toHaveValue("0.12");
1216
+ }));
1217
+ (0, fixtures_1.test)("placing decimal separator before an integer adds a leading 0 (#2)", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, }) {
1218
+ yield initTestBed(`<NumberBox />`);
1219
+ const input = page.getByRole("textbox");
1220
+ yield input.fill("");
1221
+ yield input.press(".");
1222
+ yield (0, fixtures_1.expect)(input).toHaveValue("0.");
1223
+ }));
1224
+ (0, fixtures_1.test)("adding floating point to the end adds a trailing 0 when blurred", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, }) {
1225
+ yield initTestBed(`<NumberBox />`);
1226
+ const input = page.getByRole("textbox");
1227
+ yield input.pressSequentially("123.");
1228
+ yield input.blur();
1229
+ yield (0, fixtures_1.expect)(input).toHaveValue("123.0");
1230
+ }));
1231
+ });