xmlui 0.10.13 → 0.10.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/{index-Db5iQkFp.mjs → index-axjeT2uJ.mjs} +1626 -1080
- package/dist/lib/index.css +1 -1
- package/dist/lib/{initMock-B9LtmFJG.mjs → initMock-BoTWMs19.mjs} +1 -1
- package/dist/lib/language-server-web-worker.mjs +1 -1
- package/dist/lib/language-server.mjs +1 -1
- package/dist/lib/{metadata-utils-D90qqMGc.mjs → metadata-utils-CtY0QcvH.mjs} +2 -1
- package/dist/lib/{server-common-lmBDLpUh.mjs → server-common-Cine5nRR.mjs} +1 -1
- package/dist/lib/xmlui.d.ts +99 -6
- package/dist/lib/xmlui.mjs +78 -42
- package/dist/metadata/{collectedComponentMetadata-BN8eg9Gr.mjs → collectedComponentMetadata-CQywuPDB.mjs} +17448 -16984
- package/dist/metadata/{initMock-J7pN8owj.mjs → initMock-Bi5kF5Af.mjs} +1 -1
- package/dist/metadata/style.css +1 -1
- package/dist/metadata/xmlui-metadata.mjs +1 -1
- package/dist/metadata/xmlui-metadata.umd.js +3 -3
- package/dist/scripts/bin/build-lib.js +21 -13
- package/dist/scripts/bin/viteConfig.js +3 -1
- package/dist/scripts/package.json +2 -3
- package/dist/scripts/src/abstractions/scripting/Token.js +2 -0
- package/dist/scripts/src/abstractions/scripting/TryScope.js +2 -0
- package/dist/scripts/src/abstractions/scripting/modules.js +2 -0
- package/dist/scripts/src/components/APICall/APICall.spec.js +910 -0
- package/dist/scripts/src/components/Accordion/Accordion.spec.js +969 -0
- package/dist/scripts/src/components/Animation/Animation.js +50 -0
- package/dist/scripts/src/components/App/App.spec.js +219 -0
- package/dist/scripts/src/components/AppHeader/AppHeader.spec.js +169 -0
- package/dist/scripts/src/components/AppState/AppState.js +32 -2
- package/dist/scripts/src/components/AppState/AppState.spec.js +268 -0
- package/dist/scripts/src/components/AppState/AppStateNative.js +27 -3
- package/dist/scripts/src/components/AutoComplete/AutoComplete.spec.js +383 -0
- package/dist/scripts/src/components/Avatar/Avatar.spec.js +1543 -0
- package/dist/scripts/src/components/Backdrop/Backdrop.spec.js +131 -0
- package/dist/scripts/src/components/Badge/Badge.spec.js +2214 -0
- package/dist/scripts/src/components/Bookmark/Bookmark.spec.js +230 -0
- package/dist/scripts/src/components/Breakout/Breakout.spec.js +56 -0
- package/dist/scripts/src/components/Button/Button-style.spec.js +274 -0
- package/dist/scripts/src/components/Button/Button.js +5 -1
- package/dist/scripts/src/components/Button/Button.spec.js +454 -0
- package/dist/scripts/src/components/Card/Card.spec.js +150 -0
- package/dist/scripts/src/components/Carousel/Carousel.spec.js +343 -0
- package/dist/scripts/src/components/Carousel/CarouselNative.js +2 -2
- package/dist/scripts/src/components/ChangeListener/ChangeListener.spec.js +169 -0
- package/dist/scripts/src/components/Charts/AreaChart/AreaChart.spec.js +999 -0
- package/dist/scripts/src/components/Charts/BarChart/BarChart.spec.js +597 -0
- package/dist/scripts/src/components/Charts/DonutChart/DonutChart.spec.js +608 -0
- package/dist/scripts/src/components/Charts/LabelList/LabelList.spec.js +539 -0
- package/dist/scripts/src/components/Charts/Legend/Legend.spec.js +558 -0
- package/dist/scripts/src/components/Charts/LineChart/LineChart.spec.js +450 -0
- package/dist/scripts/src/components/Charts/PieChart/PieChart.spec.js +584 -0
- package/dist/scripts/src/components/Charts/PieChart/PieChartNative.js +41 -2
- package/dist/scripts/src/components/Charts/RadarChart/RadarChart.spec.js +571 -0
- package/dist/scripts/src/components/Charts/Tooltip/TooltipContent.spec.js +449 -0
- package/dist/scripts/src/components/Checkbox/Checkbox.spec.js +964 -0
- package/dist/scripts/src/components/CodeBlock/CodeBlock.spec.js +196 -0
- package/dist/scripts/src/components/ColorPicker/ColorPicker.spec.js +283 -0
- package/dist/scripts/src/components/ColorPicker/ColorPickerNative.js +9 -26
- package/dist/scripts/src/components/Column/doc-resources/list-component-data.js +53 -0
- package/dist/scripts/src/components/ComponentProvider.js +6 -2
- package/dist/scripts/src/components/ContentSeparator/ContentSeparator.spec.js +338 -0
- package/dist/scripts/src/components/DateInput/DateInput.spec.js +918 -0
- package/dist/scripts/src/components/DatePicker/DatePicker.spec.js +362 -0
- package/dist/scripts/src/components/DatePicker/DatePickerNative.js +3 -3
- package/dist/scripts/src/components/DropdownMenu/DropdownMenu.spec.js +331 -0
- package/dist/scripts/src/components/DropdownMenu/DropdownMenuNative.js +7 -9
- package/dist/scripts/src/components/EmojiSelector/EmojiSelector.spec.js +29 -0
- package/dist/scripts/src/components/ExpandableItem/ExpandableItem.spec.js +435 -0
- package/dist/scripts/src/components/FileInput/FileInput.spec.js +249 -0
- package/dist/scripts/src/components/FileUploadDropZone/FileUploadDropZone.spec.js +296 -0
- package/dist/scripts/src/components/FlowLayout/FlowLayout.spec.js +518 -0
- package/dist/scripts/src/components/Footer/Footer.spec.js +991 -0
- package/dist/scripts/src/components/Form/Form.spec.js +1257 -0
- package/dist/scripts/src/components/FormItem/FormItem.spec.js +723 -0
- package/dist/scripts/src/components/FormItem/ItemWithLabel.js +3 -3
- package/dist/scripts/src/components/FormSection/FormSection.js +6 -31
- package/dist/scripts/src/components/Fragment/Fragment.spec.js +50 -0
- package/dist/scripts/src/components/Heading/H1.spec.js +66 -0
- package/dist/scripts/src/components/Heading/H2.spec.js +66 -0
- package/dist/scripts/src/components/Heading/H3.spec.js +66 -0
- package/dist/scripts/src/components/Heading/H4.spec.js +66 -0
- package/dist/scripts/src/components/Heading/H5.spec.js +66 -0
- package/dist/scripts/src/components/Heading/H6.spec.js +66 -0
- package/dist/scripts/src/components/Heading/Heading.spec.js +897 -0
- package/dist/scripts/src/components/HtmlTags/HtmlTags.spec.js +69 -0
- package/dist/scripts/src/components/IFrame/IFrame.spec.js +527 -0
- package/dist/scripts/src/components/Icon/ArrowDropDown.js +11 -0
- package/dist/scripts/src/components/Icon/ArrowDropUp.js +11 -0
- package/dist/scripts/src/components/Icon/ArrowLeft.js +11 -0
- package/dist/scripts/src/components/Icon/ArrowRight.js +11 -0
- package/dist/scripts/src/components/Icon/ChevronDownIcon.js +7 -0
- package/dist/scripts/src/components/Icon/ChevronUpIcon.js +7 -0
- package/dist/scripts/src/components/Icon/Icon.spec.js +527 -0
- package/dist/scripts/src/components/Icon/SunIcon.js +10 -0
- package/dist/scripts/src/components/Image/Image.js +2 -1
- package/dist/scripts/src/components/Image/Image.spec.js +198 -0
- package/dist/scripts/src/components/Image/ImageNative.js +30 -2
- package/dist/scripts/src/components/Input/InputLabel.js +25 -0
- package/dist/scripts/src/components/Input/index.js +5 -0
- package/dist/scripts/src/components/Items/Items.spec.js +397 -0
- package/dist/scripts/src/components/Link/Link.spec.js +894 -0
- package/dist/scripts/src/components/List/List.spec.js +927 -0
- package/dist/scripts/src/components/List/doc-resources/list-component-data.js +53 -0
- package/dist/scripts/src/components/Markdown/Markdown.spec.js +188 -0
- package/dist/scripts/src/components/ModalDialog/ModalDialog.spec.js +162 -0
- package/dist/scripts/src/components/NavGroup/NavGroup.spec.js +212 -0
- package/dist/scripts/src/components/NavGroup/NavGroupNative.js +15 -7
- package/dist/scripts/src/components/NavLink/NavLink.spec.js +864 -0
- package/dist/scripts/src/components/NavPanel/NavPanel.spec.js +864 -0
- package/dist/scripts/src/components/NoResult/NoResult.spec.js +863 -0
- package/dist/scripts/src/components/NumberBox/NumberBox.spec.js +1237 -0
- package/dist/scripts/src/components/Option/Option.spec.js +472 -0
- package/dist/scripts/src/components/PageMetaTitle/PageMetaTitle.spec.js +80 -0
- package/dist/scripts/src/components/Pagination/Pagination.spec.js +1003 -0
- package/dist/scripts/src/components/ProfileMenu/ProfileMenu.js +20 -0
- package/dist/scripts/src/components/ProgressBar/ProgressBar.spec.js +166 -0
- package/dist/scripts/src/components/Queue/Queue.spec.js +626 -0
- package/dist/scripts/src/components/RadioGroup/RadioGroup.spec.js +479 -0
- package/dist/scripts/src/components/Redirect/Redirect.spec.js +527 -0
- package/dist/scripts/src/components/ResponsiveBar/ResponsiveBar.spec.js +76 -0
- package/dist/scripts/src/components/Select/Select.spec.js +527 -0
- package/dist/scripts/src/components/SelectionStore/SelectionStoreNative.js +3 -1
- package/dist/scripts/src/components/Slider/Slider.js +2 -0
- package/dist/scripts/src/components/Slider/Slider.spec.js +574 -0
- package/dist/scripts/src/components/Slider/SliderNative.js +63 -26
- package/dist/scripts/src/components/Slot/Slot.spec.js +368 -0
- package/dist/scripts/src/components/SpaceFiller/SpaceFiller.spec.js +184 -0
- package/dist/scripts/src/components/Spinner/Spinner.spec.js +161 -0
- package/dist/scripts/src/components/Splitter/HSplitter.spec.js +104 -0
- package/dist/scripts/src/components/Splitter/Splitter.spec.js +543 -0
- package/dist/scripts/src/components/Splitter/VSplitter.spec.js +104 -0
- package/dist/scripts/src/components/Stack/CHStack.spec.js +86 -0
- package/dist/scripts/src/components/Stack/CVStack.spec.js +86 -0
- package/dist/scripts/src/components/Stack/HStack.spec.js +67 -0
- package/dist/scripts/src/components/Stack/Stack.spec.js +654 -0
- package/dist/scripts/src/components/Stack/VStack.spec.js +67 -0
- package/dist/scripts/src/components/Switch/Switch.spec.js +829 -0
- package/dist/scripts/src/components/Table/Table.js +7 -1
- package/dist/scripts/src/components/Table/Table.spec.js +555 -0
- package/dist/scripts/src/components/Table/TableNative.js +4 -1
- package/dist/scripts/src/components/Table/doc-resources/list-component-data.js +53 -0
- package/dist/scripts/src/components/Table/useRowSelection.js +215 -1
- package/dist/scripts/src/components/TableOfContents/TableOfContents.spec.js +838 -0
- package/dist/scripts/src/components/Tabs/Tabs.spec.js +875 -0
- package/dist/scripts/src/components/Text/Text.spec.js +1075 -0
- package/dist/scripts/src/components/TextArea/TextArea.spec.js +714 -0
- package/dist/scripts/src/components/TextBox/TextBox.js +1 -5
- package/dist/scripts/src/components/TextBox/TextBox.spec.js +687 -0
- package/dist/scripts/src/components/TextBox/TextBoxNative.js +10 -15
- package/dist/scripts/src/components/Theme/Theme.spec.js +124 -0
- package/dist/scripts/src/components/Theme/ThemeNative.js +2 -6
- package/dist/scripts/src/components/TimeInput/TimeInput.js +1 -5
- package/dist/scripts/src/components/TimeInput/TimeInput.spec.js +1122 -0
- package/dist/scripts/src/components/TimeInput/TimeInputNative.js +2 -9
- package/dist/scripts/src/components/Timer/Timer.spec.js +358 -0
- package/dist/scripts/src/components/ToneChangerButton/ToneChangerButton.spec.js +414 -0
- package/dist/scripts/src/components/ToneSwitch/ToneSwitch.spec.js +89 -0
- package/dist/scripts/src/components/Tooltip/Tooltip.spec.js +418 -0
- package/dist/scripts/src/components/chart-color-schemes.js +43 -0
- package/dist/scripts/src/components-core/ApiBoundComponent.js +38 -24
- package/dist/scripts/src/components-core/CompoundComponent.js +1 -1
- package/dist/scripts/src/components-core/RestApiProxy.js +84 -8
- package/dist/scripts/src/components-core/behaviors/BehaviorContext.js +54 -0
- package/dist/scripts/src/components-core/behaviors/CoreBehaviors.js +80 -0
- package/dist/scripts/src/components-core/descriptorHelper.js +1 -0
- package/dist/scripts/src/components-core/devtools/InspectorDialogVisibilityContext.js +8 -0
- package/dist/scripts/src/components-core/parts.js +4 -1
- package/dist/scripts/src/components-core/renderers.js +31 -0
- package/dist/scripts/src/components-core/rendering/AppRoot.js +2 -1
- package/dist/scripts/src/components-core/rendering/ComponentAdapter.js +31 -46
- package/dist/scripts/src/components-core/rendering/nodeUtils.js +6 -0
- package/dist/scripts/src/components-core/script-runner/simplify-expression.js +386 -0
- package/dist/scripts/src/components-core/theming/component-layout-resolver.js +153 -0
- package/dist/scripts/src/components-core/theming/layout-resolver.js +2 -0
- package/dist/scripts/src/components-core/theming/parse-layout-props.js +98 -0
- package/dist/scripts/src/components-core/theming/themes/solid.js +16 -0
- package/dist/scripts/src/components-core/utils/audio-utils.js +83 -0
- package/dist/scripts/src/index-standalone.js +61 -0
- package/dist/scripts/src/index.js +39 -1
- package/dist/scripts/src/language-server/server-common.js +151 -0
- package/dist/scripts/src/language-server/server-web-worker.js +47 -0
- package/dist/scripts/src/language-server/server.js +42 -0
- package/dist/scripts/src/language-server/services/common/docs-generation.js +73 -0
- package/dist/scripts/src/language-server/services/common/lsp-utils.js +9 -0
- package/dist/scripts/src/language-server/services/common/syntax-node-utilities.js +135 -0
- package/dist/scripts/src/language-server/services/completion.js +270 -0
- package/dist/scripts/src/language-server/services/diagnostic.js +19 -0
- package/dist/scripts/src/language-server/services/format.js +430 -0
- package/dist/scripts/src/language-server/services/hover.js +164 -0
- package/dist/scripts/src/language-server/xmlui-metadata-generated.mjs +16266 -0
- package/dist/scripts/src/logging/xmlui.js +21 -0
- package/dist/scripts/src/parsers/common/utils.js +19 -0
- package/dist/scripts/src/syntax/monaco/grammar.monacoLanguage.js +286 -0
- package/dist/scripts/src/syntax/monaco/index.js +14 -0
- package/dist/scripts/src/syntax/monaco/xmlui-dark.js +25 -0
- package/dist/scripts/src/syntax/monaco/xmlui-light.js +25 -0
- package/dist/scripts/src/syntax/monaco/xmluiscript.monacoLanguage.js +310 -0
- package/dist/scripts/src/syntax/textMate/index.js +14 -0
- package/dist/scripts/src/syntax/textMate/xmlui-dark.json +631 -0
- package/dist/scripts/src/syntax/textMate/xmlui-light.json +565 -0
- package/dist/scripts/src/syntax/textMate/xmlui.json +564 -0
- package/dist/scripts/src/syntax/textMate/xmlui.tmLanguage.json +341 -0
- package/dist/scripts/src/testing/ComponentDrivers.js +1327 -0
- package/dist/scripts/src/testing/assertions.js +444 -0
- package/dist/scripts/src/testing/component-test-helpers.js +389 -0
- package/dist/scripts/src/testing/drivers/DateInputDriver.js +19 -0
- package/dist/scripts/src/testing/drivers/ModalDialogDriver.js +10 -0
- package/dist/scripts/src/testing/drivers/NumberBoxDriver.js +44 -0
- package/dist/scripts/src/testing/drivers/SliderDriver.js +20 -0
- package/dist/scripts/src/testing/drivers/TextBoxDriver.js +20 -0
- package/dist/scripts/src/testing/drivers/TimeInputDriver.js +22 -0
- package/dist/scripts/src/testing/drivers/TimerDriver.js +64 -0
- package/dist/scripts/src/testing/fixtures.js +513 -0
- package/dist/scripts/src/testing/infrastructure/TestBed.js +17 -0
- package/dist/scripts/src/testing/infrastructure/main.js +9 -0
- package/dist/scripts/src/testing/infrastructure/public/mockServiceWorker.js +266 -0
- package/dist/scripts/src/testing/themed-app-test-helpers.js +139 -0
- package/dist/standalone/xmlui-standalone.es.d.ts +172 -10
- package/dist/standalone/xmlui-standalone.umd.js +36 -36
- package/package.json +2 -3
|
@@ -23,7 +23,6 @@ const PartialInput_1 = require("../Input/PartialInput");
|
|
|
23
23
|
const InputDivider_1 = require("../Input/InputDivider");
|
|
24
24
|
const misc_1 = require("../../components-core/utils/misc");
|
|
25
25
|
const InputAdornment_1 = require("../Input/InputAdornment");
|
|
26
|
-
const ItemWithLabel_1 = require("../FormItem/ItemWithLabel");
|
|
27
26
|
const IconNative_1 = __importDefault(require("../Icon/IconNative"));
|
|
28
27
|
// Import utilities and types from merged utils file
|
|
29
28
|
const utils_1 = require("./utils");
|
|
@@ -41,14 +40,12 @@ exports.defaultProps = {
|
|
|
41
40
|
clearable: false,
|
|
42
41
|
clearToInitialValue: true,
|
|
43
42
|
required: false,
|
|
44
|
-
labelPosition: "top",
|
|
45
43
|
readOnly: false,
|
|
46
44
|
autoFocus: false,
|
|
47
|
-
labelBreak: false,
|
|
48
45
|
emptyCharacter: "-",
|
|
49
46
|
};
|
|
50
47
|
exports.TimeInputNative = (0, react_1.forwardRef)(function TimeInputNative(_a, ref) {
|
|
51
|
-
var { id, initialValue, value: controlledValue, enabled = exports.defaultProps.enabled, updateState, style, className, onDidChange, onFocus, onBlur, onInvalidChange, validationStatus = exports.defaultProps.validationStatus, registerComponentApi, hour24 = exports.defaultProps.hour24, seconds = exports.defaultProps.seconds, minTime, maxTime, clearable = exports.defaultProps.clearable, clearIcon, clearToInitialValue = exports.defaultProps.clearToInitialValue, required = exports.defaultProps.required, startText, startIcon, endText, endIcon, gap,
|
|
48
|
+
var { id, initialValue, value: controlledValue, enabled = exports.defaultProps.enabled, updateState, style, className, onDidChange, onFocus, onBlur, onInvalidChange, validationStatus = exports.defaultProps.validationStatus, registerComponentApi, hour24 = exports.defaultProps.hour24, seconds = exports.defaultProps.seconds, minTime, maxTime, clearable = exports.defaultProps.clearable, clearIcon, clearToInitialValue = exports.defaultProps.clearToInitialValue, required = exports.defaultProps.required, startText, startIcon, endText, endIcon, gap, readOnly = exports.defaultProps.readOnly, autoFocus = exports.defaultProps.autoFocus, emptyCharacter = exports.defaultProps.emptyCharacter } = _a, rest = __rest(_a, ["id", "initialValue", "value", "enabled", "updateState", "style", "className", "onDidChange", "onFocus", "onBlur", "onInvalidChange", "validationStatus", "registerComponentApi", "hour24", "seconds", "minTime", "maxTime", "clearable", "clearIcon", "clearToInitialValue", "required", "startText", "startIcon", "endText", "endIcon", "gap", "readOnly", "autoFocus", "emptyCharacter"]);
|
|
52
49
|
const timeInputRef = (0, react_1.useRef)(null);
|
|
53
50
|
// Refs for auto-tabbing between inputs
|
|
54
51
|
const hourInputRef = (0, react_1.useRef)(null);
|
|
@@ -412,11 +409,7 @@ exports.TimeInputNative = (0, react_1.forwardRef)(function TimeInputNative(_a, r
|
|
|
412
409
|
[TimeInput_module_scss_1.default.valid]: validationStatus === "valid",
|
|
413
410
|
[TimeInput_module_scss_1.default.disabled]: !enabled,
|
|
414
411
|
[TimeInput_module_scss_1.default.readOnly]: readOnly,
|
|
415
|
-
}, className), style: Object.assign(Object.assign({}, style), { gap }), onFocusCapture: handleComponentFocus, onBlur: handleComponentBlur, "data-validation-status": validationStatus }, rest, { children: [startAdornment, (0, jsx_runtime_1.jsxs)("div", { className: TimeInput_module_scss_1.default.wrapper, children: [(0, jsx_runtime_1.jsxs)("div", { className: TimeInput_module_scss_1.default.inputGroup, children: [(0, jsx_runtime_1.jsx)(HourInput, { amPm: amPm, autoFocus: autoFocus, disabled: !enabled, inputRef: hourInputRef, nextInputRef: minuteInputRef, maxTime: maxTime, minTime: minTime, onChange: handleHourChange, onBlur: handleHourBlur, onKeyDown: handleArrowKeys, readOnly: readOnly, required: required, value: hour, isInvalid: isHourCurrentlyInvalid, is24Hour: !is12HourFormat, emptyCharacter: processedEmptyCharacter }), (0, jsx_runtime_1.jsx)(InputDivider_1.InputDivider, { separator: ":" }), (0, jsx_runtime_1.jsx)(MinuteInput, { disabled: !enabled, hour: hour, inputRef: minuteInputRef, nextInputRef: showSeconds ? secondInputRef : undefined, nextButtonRef: showSeconds ? undefined : is12HourFormat ? amPmButtonRef : undefined, maxTime: maxTime, minTime: minTime, onChange: handleMinuteChange, onBlur: handleMinuteBlur, onKeyDown: handleArrowKeys, readOnly: readOnly, required: required, showLeadingZeros: showLeadingZeros, value: minute, isInvalid: isMinuteCurrentlyInvalid, emptyCharacter: processedEmptyCharacter }), showSeconds && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(InputDivider_1.InputDivider, { separator: ":", className: TimeInput_module_scss_1.default.divider }), (0, jsx_runtime_1.jsx)(SecondInput, { disabled: !enabled, hour: hour, inputRef: secondInputRef, nextButtonRef: is12HourFormat ? amPmButtonRef : undefined, maxTime: maxTime, minTime: minTime, minute: minute, onChange: handleSecondChange, onBlur: handleSecondBlur, onKeyDown: handleArrowKeys, readOnly: readOnly, required: required, showLeadingZeros: showLeadingZeros, value: second, isInvalid: isSecondCurrentlyInvalid, emptyCharacter: processedEmptyCharacter })] })), is12HourFormat && ((0, jsx_runtime_1.jsx)(AmPmButton, { className: "timeinput", disabled: !enabled, buttonRef: amPmButtonRef, maxTime: maxTime, minTime: minTime, onClick: handleAmPmToggle, onAmPmSet: handleAmPmSet, onKeyDown: handleArrowKeys, value: amPm }))] }), clearable && ((0, jsx_runtime_1.jsx)("button", { "data-part-id": PART_CLEAR_BUTTON, className: (0, classnames_1.default)(TimeInput_module_scss_1.default.clearButton, TimeInput_module_scss_1.default.button), disabled: !enabled, onClick: clear, onFocus: stopPropagation, type: "button", children: clearIconElement }))] }), endAdornment] })));
|
|
416
|
-
// Wrap with label if needed
|
|
417
|
-
if (label) {
|
|
418
|
-
return ((0, jsx_runtime_1.jsx)(ItemWithLabel_1.ItemWithLabel, { label: label, labelPosition: labelPosition, labelWidth: labelWidth, labelBreak: labelBreak, required: required, children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [startAdornment, timeInputComponent, endAdornment] }) }));
|
|
419
|
-
}
|
|
412
|
+
}, className), style: Object.assign(Object.assign({}, style), { gap }), onFocusCapture: handleComponentFocus, onBlur: handleComponentBlur, "data-validation-status": validationStatus }, rest, { children: [startAdornment, (0, jsx_runtime_1.jsxs)("div", { className: TimeInput_module_scss_1.default.wrapper, children: [(0, jsx_runtime_1.jsxs)("div", { className: TimeInput_module_scss_1.default.inputGroup, children: [(0, jsx_runtime_1.jsx)(HourInput, { id: id, amPm: amPm, autoFocus: autoFocus, disabled: !enabled, inputRef: hourInputRef, nextInputRef: minuteInputRef, maxTime: maxTime, minTime: minTime, onChange: handleHourChange, onBlur: handleHourBlur, onKeyDown: handleArrowKeys, readOnly: readOnly, required: required, value: hour, isInvalid: isHourCurrentlyInvalid, is24Hour: !is12HourFormat, emptyCharacter: processedEmptyCharacter }), (0, jsx_runtime_1.jsx)(InputDivider_1.InputDivider, { separator: ":" }), (0, jsx_runtime_1.jsx)(MinuteInput, { disabled: !enabled, hour: hour, inputRef: minuteInputRef, nextInputRef: showSeconds ? secondInputRef : undefined, nextButtonRef: showSeconds ? undefined : is12HourFormat ? amPmButtonRef : undefined, maxTime: maxTime, minTime: minTime, onChange: handleMinuteChange, onBlur: handleMinuteBlur, onKeyDown: handleArrowKeys, readOnly: readOnly, required: required, showLeadingZeros: showLeadingZeros, value: minute, isInvalid: isMinuteCurrentlyInvalid, emptyCharacter: processedEmptyCharacter }), showSeconds && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(InputDivider_1.InputDivider, { separator: ":", className: TimeInput_module_scss_1.default.divider }), (0, jsx_runtime_1.jsx)(SecondInput, { disabled: !enabled, hour: hour, inputRef: secondInputRef, nextButtonRef: is12HourFormat ? amPmButtonRef : undefined, maxTime: maxTime, minTime: minTime, minute: minute, onChange: handleSecondChange, onBlur: handleSecondBlur, onKeyDown: handleArrowKeys, readOnly: readOnly, required: required, showLeadingZeros: showLeadingZeros, value: second, isInvalid: isSecondCurrentlyInvalid, emptyCharacter: processedEmptyCharacter })] })), is12HourFormat && ((0, jsx_runtime_1.jsx)(AmPmButton, { className: "timeinput", disabled: !enabled, buttonRef: amPmButtonRef, maxTime: maxTime, minTime: minTime, onClick: handleAmPmToggle, onAmPmSet: handleAmPmSet, onKeyDown: handleArrowKeys, value: amPm }))] }), clearable && ((0, jsx_runtime_1.jsx)("button", { "data-part-id": PART_CLEAR_BUTTON, className: (0, classnames_1.default)(TimeInput_module_scss_1.default.clearButton, TimeInput_module_scss_1.default.button), disabled: !enabled, onClick: clear, onFocus: stopPropagation, type: "button", children: clearIconElement }))] }), endAdornment] })));
|
|
420
413
|
return timeInputComponent;
|
|
421
414
|
});
|
|
422
415
|
function AmPmButton({ ariaLabel, autoFocus, className, disabled, locale, maxTime, minTime, onClick, onAmPmSet, onKeyDown, buttonRef, value, }) {
|
|
@@ -0,0 +1,358 @@
|
|
|
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 fixtures_1 = require("../../testing/fixtures");
|
|
13
|
+
fixtures_1.test.describe("Basic Functionality", () => {
|
|
14
|
+
(0, fixtures_1.test)("component renders with default props", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
15
|
+
yield initTestBed(`<Timer testId="timer" />`);
|
|
16
|
+
const timer = page.getByTestId("timer");
|
|
17
|
+
yield (0, fixtures_1.expect)(timer).toHaveAttribute("data-timer-enabled", "true");
|
|
18
|
+
yield (0, fixtures_1.expect)(timer).toHaveAttribute("data-timer-interval", "1000");
|
|
19
|
+
}));
|
|
20
|
+
(0, fixtures_1.test)("component renders with enabled=false", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
21
|
+
yield initTestBed(`<Timer testId="timer" enabled="false" />`);
|
|
22
|
+
const timer = page.getByTestId("timer");
|
|
23
|
+
yield (0, fixtures_1.expect)(timer).toHaveAttribute("data-timer-enabled", "false");
|
|
24
|
+
yield (0, fixtures_1.expect)(timer).toHaveAttribute("data-timer-running", "false");
|
|
25
|
+
}));
|
|
26
|
+
(0, fixtures_1.test)("component renders with custom interval", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
27
|
+
yield initTestBed(`<Timer testId="timer" interval="500" />`);
|
|
28
|
+
const timer = page.getByTestId("timer");
|
|
29
|
+
yield (0, fixtures_1.expect)(timer).toHaveAttribute("data-timer-interval", "500");
|
|
30
|
+
}));
|
|
31
|
+
(0, fixtures_1.test)("component renders with once=true", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
32
|
+
yield initTestBed(`<Timer testId="timer" once="true" />`);
|
|
33
|
+
const timer = page.getByTestId("timer");
|
|
34
|
+
yield (0, fixtures_1.expect)(timer).toHaveAttribute("data-timer-once", "true");
|
|
35
|
+
}));
|
|
36
|
+
(0, fixtures_1.test)("component renders with initial delay", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
37
|
+
yield initTestBed(`<Timer testId="timer" initialDelay="500" />`);
|
|
38
|
+
const timer = page.getByTestId("timer");
|
|
39
|
+
yield (0, fixtures_1.expect)(timer).toHaveAttribute("data-timer-initial-delay", "500");
|
|
40
|
+
}));
|
|
41
|
+
(0, fixtures_1.test)("component is not visible (non-visual component)", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
42
|
+
yield initTestBed(`<Timer testId="timer" />`);
|
|
43
|
+
const timer = page.getByTestId("timer");
|
|
44
|
+
yield (0, fixtures_1.expect)(timer).not.toBeVisible();
|
|
45
|
+
}));
|
|
46
|
+
});
|
|
47
|
+
fixtures_1.test.describe("Event Handling", () => {
|
|
48
|
+
(0, fixtures_1.test)("timer tick event is called", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
49
|
+
yield initTestBed(`
|
|
50
|
+
<Fragment var.tickCount="{0}">
|
|
51
|
+
<Timer interval="1000" enabled="true" onTick="tickCount++" />
|
|
52
|
+
<Text testId="counter">{tickCount}</Text>
|
|
53
|
+
</Fragment>
|
|
54
|
+
`);
|
|
55
|
+
const counter = page.getByTestId("counter");
|
|
56
|
+
// Wait for a few ticks
|
|
57
|
+
yield (0, fixtures_1.expect)(counter).toHaveText("0");
|
|
58
|
+
// Wait for the first tick (1000ms + some buffer)
|
|
59
|
+
yield page.waitForTimeout(1200);
|
|
60
|
+
yield (0, fixtures_1.expect)(counter).toHaveText("1");
|
|
61
|
+
// Wait for the second tick
|
|
62
|
+
yield page.waitForTimeout(1000);
|
|
63
|
+
yield (0, fixtures_1.expect)(counter).toHaveText("2");
|
|
64
|
+
}));
|
|
65
|
+
(0, fixtures_1.test)("timer stops when enabled is false", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
66
|
+
yield initTestBed(`
|
|
67
|
+
<Fragment var.tickCount="{0}" var.timerEnabled="{true}">
|
|
68
|
+
<Timer interval="1000" enabled="{timerEnabled}" onTick="tickCount++" />
|
|
69
|
+
<Button testId="stopButton" onClick="timerEnabled = false">Stop Timer</Button>
|
|
70
|
+
<Text testId="counter">{tickCount}</Text>
|
|
71
|
+
</Fragment>
|
|
72
|
+
`);
|
|
73
|
+
const counter = page.getByTestId("counter");
|
|
74
|
+
const stopButton = page.getByTestId("stopButton");
|
|
75
|
+
// Wait for the first tick
|
|
76
|
+
yield page.waitForTimeout(1200);
|
|
77
|
+
yield (0, fixtures_1.expect)(counter).toHaveText("1");
|
|
78
|
+
// Stop the timer
|
|
79
|
+
yield stopButton.click();
|
|
80
|
+
// Wait and verify it doesn't increment
|
|
81
|
+
yield page.waitForTimeout(1500);
|
|
82
|
+
yield (0, fixtures_1.expect)(counter).toHaveText("1");
|
|
83
|
+
}));
|
|
84
|
+
(0, fixtures_1.test)("timer prevents overlapping events", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
85
|
+
// This test verifies that a new tick event doesn't fire if the previous one hasn't completed
|
|
86
|
+
yield initTestBed(`
|
|
87
|
+
<Fragment var.tickCount="{0}" var.processingTime="{2000}">
|
|
88
|
+
<Timer
|
|
89
|
+
interval="1000"
|
|
90
|
+
enabled="true"
|
|
91
|
+
onTick="
|
|
92
|
+
tickCount++;
|
|
93
|
+
delay(processingTime);
|
|
94
|
+
"
|
|
95
|
+
/>
|
|
96
|
+
<Text testId="counter">{tickCount}</Text>
|
|
97
|
+
</Fragment>
|
|
98
|
+
`);
|
|
99
|
+
const counter = page.getByTestId("counter");
|
|
100
|
+
// First tick should start and take 2000ms to complete
|
|
101
|
+
// but interval is 1000ms, so second tick should not start until first completes
|
|
102
|
+
yield page.waitForTimeout(2500); // Wait for first tick to complete
|
|
103
|
+
yield (0, fixtures_1.expect)(counter).toHaveText("1");
|
|
104
|
+
// Wait a bit more to see if overlapping was prevented
|
|
105
|
+
yield page.waitForTimeout(1500); // Should be enough for second tick to start
|
|
106
|
+
yield (0, fixtures_1.expect)(counter).toHaveText("2");
|
|
107
|
+
}));
|
|
108
|
+
});
|
|
109
|
+
fixtures_1.test.describe("Initial Delay Functionality", () => {
|
|
110
|
+
(0, fixtures_1.test)("timer waits for initial delay before first tick", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
111
|
+
yield initTestBed(`
|
|
112
|
+
<Fragment var.tickCount="{0}">
|
|
113
|
+
<Timer interval="1000" initialDelay="2000" onTick="tickCount++" />
|
|
114
|
+
<Text testId="counter">{tickCount}</Text>
|
|
115
|
+
</Fragment>
|
|
116
|
+
`);
|
|
117
|
+
const counter = page.getByTestId("counter");
|
|
118
|
+
// Should not tick immediately
|
|
119
|
+
yield (0, fixtures_1.expect)(counter).toHaveText("0");
|
|
120
|
+
// Should not tick before initial delay
|
|
121
|
+
yield page.waitForTimeout(1500);
|
|
122
|
+
yield (0, fixtures_1.expect)(counter).toHaveText("0");
|
|
123
|
+
// Should tick after initial delay
|
|
124
|
+
yield page.waitForTimeout(1000); // Total 2500ms, past the 2000ms initial delay + 1000ms interval
|
|
125
|
+
yield (0, fixtures_1.expect)(counter).toHaveText("1");
|
|
126
|
+
// Should continue ticking at interval
|
|
127
|
+
yield page.waitForTimeout(1000);
|
|
128
|
+
yield (0, fixtures_1.expect)(counter).toHaveText("2");
|
|
129
|
+
}));
|
|
130
|
+
(0, fixtures_1.test)("initial delay only applies to first execution, not restarts", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
131
|
+
yield initTestBed(`
|
|
132
|
+
<Fragment var.tickCount="{0}" var.timerEnabled="{true}">
|
|
133
|
+
<Timer
|
|
134
|
+
interval="1000"
|
|
135
|
+
initialDelay="2000"
|
|
136
|
+
enabled="{timerEnabled}"
|
|
137
|
+
onTick="tickCount++"
|
|
138
|
+
/>
|
|
139
|
+
<Button testId="restartButton" onClick="timerEnabled = false; timerEnabled = true">Restart</Button>
|
|
140
|
+
<Text testId="counter">{tickCount}</Text>
|
|
141
|
+
</Fragment>
|
|
142
|
+
`);
|
|
143
|
+
const counter = page.getByTestId("counter");
|
|
144
|
+
const restartButton = page.getByTestId("restartButton");
|
|
145
|
+
// Wait for initial delay + first tick
|
|
146
|
+
yield page.waitForTimeout(3500);
|
|
147
|
+
yield (0, fixtures_1.expect)(counter).toHaveText("1");
|
|
148
|
+
// Restart the timer
|
|
149
|
+
yield restartButton.click();
|
|
150
|
+
// After restart, should tick immediately without initial delay
|
|
151
|
+
yield page.waitForTimeout(1500);
|
|
152
|
+
yield (0, fixtures_1.expect)(counter).toHaveText("2");
|
|
153
|
+
}));
|
|
154
|
+
(0, fixtures_1.test)("initial delay works with once timer", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
155
|
+
yield initTestBed(`
|
|
156
|
+
<Fragment var.tickCount="{0}">
|
|
157
|
+
<Timer interval="1000" initialDelay="2000" once="true" onTick="tickCount++" />
|
|
158
|
+
<Text testId="counter">{tickCount}</Text>
|
|
159
|
+
</Fragment>
|
|
160
|
+
`);
|
|
161
|
+
const counter = page.getByTestId("counter");
|
|
162
|
+
// Should not tick before initial delay
|
|
163
|
+
yield page.waitForTimeout(1500);
|
|
164
|
+
yield (0, fixtures_1.expect)(counter).toHaveText("0");
|
|
165
|
+
// Should tick once after initial delay
|
|
166
|
+
yield page.waitForTimeout(1000);
|
|
167
|
+
yield (0, fixtures_1.expect)(counter).toHaveText("1");
|
|
168
|
+
// Should not tick again
|
|
169
|
+
yield page.waitForTimeout(2000);
|
|
170
|
+
yield (0, fixtures_1.expect)(counter).toHaveText("1");
|
|
171
|
+
}));
|
|
172
|
+
});
|
|
173
|
+
fixtures_1.test.describe("Pause and Resume API", () => {
|
|
174
|
+
(0, fixtures_1.test)("timer can be paused and resumed via API", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
175
|
+
yield initTestBed(`
|
|
176
|
+
<Fragment var.tickCount="{0}">
|
|
177
|
+
<Timer
|
|
178
|
+
id="myTimer"
|
|
179
|
+
interval="1000"
|
|
180
|
+
onTick="tickCount++"
|
|
181
|
+
/>
|
|
182
|
+
<Button testId="pauseButton" onClick="myTimer.pause()">Pause</Button>
|
|
183
|
+
<Button testId="resumeButton" onClick="myTimer.resume()">Resume</Button>
|
|
184
|
+
<Text testId="counter">{tickCount}</Text>
|
|
185
|
+
</Fragment>
|
|
186
|
+
`);
|
|
187
|
+
const counter = page.getByTestId("counter");
|
|
188
|
+
const pauseButton = page.getByTestId("pauseButton");
|
|
189
|
+
const resumeButton = page.getByTestId("resumeButton");
|
|
190
|
+
// Wait for first tick
|
|
191
|
+
yield page.waitForTimeout(1200);
|
|
192
|
+
yield (0, fixtures_1.expect)(counter).toHaveText("1");
|
|
193
|
+
// Pause the timer
|
|
194
|
+
yield pauseButton.click();
|
|
195
|
+
// Should not tick while paused
|
|
196
|
+
const currentCount = yield counter.textContent();
|
|
197
|
+
yield page.waitForTimeout(1500);
|
|
198
|
+
yield (0, fixtures_1.expect)(counter).toHaveText(currentCount || "1");
|
|
199
|
+
// Resume the timer
|
|
200
|
+
yield resumeButton.click();
|
|
201
|
+
// Should continue ticking after resume
|
|
202
|
+
yield page.waitForTimeout(1200);
|
|
203
|
+
const finalCount = parseInt((yield counter.textContent()) || "0");
|
|
204
|
+
(0, fixtures_1.expect)(finalCount).toBeGreaterThan(parseInt(currentCount || "1"));
|
|
205
|
+
}));
|
|
206
|
+
(0, fixtures_1.test)("pause during initial delay stops the delay", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
207
|
+
yield initTestBed(`
|
|
208
|
+
<Fragment var.tickCount="{0}">
|
|
209
|
+
<Timer
|
|
210
|
+
id="myTimer"
|
|
211
|
+
interval="1000"
|
|
212
|
+
initialDelay="3000"
|
|
213
|
+
onTick="tickCount++"
|
|
214
|
+
/>
|
|
215
|
+
<Button testId="pauseButton" onClick="myTimer.pause()">Pause</Button>
|
|
216
|
+
<Button testId="resumeButton" onClick="myTimer.resume()">Resume</Button>
|
|
217
|
+
<Text testId="counter">{tickCount}</Text>
|
|
218
|
+
</Fragment>
|
|
219
|
+
`);
|
|
220
|
+
const counter = page.getByTestId("counter");
|
|
221
|
+
const pauseButton = page.getByTestId("pauseButton");
|
|
222
|
+
const resumeButton = page.getByTestId("resumeButton");
|
|
223
|
+
// Pause during initial delay
|
|
224
|
+
yield page.waitForTimeout(1000);
|
|
225
|
+
yield pauseButton.click();
|
|
226
|
+
// Should not tick even after original delay would have passed
|
|
227
|
+
yield page.waitForTimeout(3000);
|
|
228
|
+
yield (0, fixtures_1.expect)(counter).toHaveText("0");
|
|
229
|
+
// Resume should start ticking
|
|
230
|
+
yield resumeButton.click();
|
|
231
|
+
yield page.waitForTimeout(1200);
|
|
232
|
+
yield (0, fixtures_1.expect)(counter).toHaveText("1");
|
|
233
|
+
}));
|
|
234
|
+
(0, fixtures_1.test)("pause state is reset when timer is disabled", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
235
|
+
yield initTestBed(`
|
|
236
|
+
<Fragment var.tickCount="{0}" var.timerEnabled="{true}">
|
|
237
|
+
<Timer
|
|
238
|
+
id="myTimer"
|
|
239
|
+
interval="1000"
|
|
240
|
+
enabled="{timerEnabled}"
|
|
241
|
+
onTick="tickCount++"
|
|
242
|
+
/>
|
|
243
|
+
<Button testId="pauseButton" onClick="myTimer.pause()">Pause</Button>
|
|
244
|
+
<Button testId="disableButton" onClick="timerEnabled = false">Disable</Button>
|
|
245
|
+
<Button testId="enableButton" onClick="timerEnabled = true">Enable</Button>
|
|
246
|
+
<Text testId="counter">{tickCount}</Text>
|
|
247
|
+
<Text testId="paused">{myTimer.isPaused() ? 'Paused' : 'Running'}</Text>
|
|
248
|
+
</Fragment>
|
|
249
|
+
`);
|
|
250
|
+
const pauseButton = page.getByTestId("pauseButton");
|
|
251
|
+
const disableButton = page.getByTestId("disableButton");
|
|
252
|
+
const enableButton = page.getByTestId("enableButton");
|
|
253
|
+
const pausedStatus = page.getByTestId("paused");
|
|
254
|
+
// Pause the timer
|
|
255
|
+
yield pauseButton.click();
|
|
256
|
+
yield (0, fixtures_1.expect)(pausedStatus).toHaveText("Paused");
|
|
257
|
+
// Disable the timer
|
|
258
|
+
yield disableButton.click();
|
|
259
|
+
// Re-enable the timer - pause state should be reset
|
|
260
|
+
yield enableButton.click();
|
|
261
|
+
yield (0, fixtures_1.expect)(pausedStatus).toHaveText("Running");
|
|
262
|
+
}));
|
|
263
|
+
});
|
|
264
|
+
fixtures_1.test.describe("Once Functionality", () => {
|
|
265
|
+
(0, fixtures_1.test)("timer with once=true fires only once", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
266
|
+
yield initTestBed(`
|
|
267
|
+
<Fragment var.tickCount="{0}">
|
|
268
|
+
<Timer interval="1000" once="true" onTick="tickCount++" />
|
|
269
|
+
<Text testId="counter">{tickCount}</Text>
|
|
270
|
+
</Fragment>
|
|
271
|
+
`);
|
|
272
|
+
const counter = page.getByTestId("counter");
|
|
273
|
+
// Wait for the first tick
|
|
274
|
+
yield page.waitForTimeout(1200);
|
|
275
|
+
yield (0, fixtures_1.expect)(counter).toHaveText("1");
|
|
276
|
+
// Wait longer to ensure it doesn't tick again
|
|
277
|
+
yield page.waitForTimeout(2000);
|
|
278
|
+
yield (0, fixtures_1.expect)(counter).toHaveText("1");
|
|
279
|
+
}));
|
|
280
|
+
(0, fixtures_1.test)("timer with once=true can be restarted by re-enabling", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
281
|
+
yield initTestBed(`
|
|
282
|
+
<Fragment var.tickCount="{0}" var.timerEnabled="{true}">
|
|
283
|
+
<Timer interval="1000" once="true" enabled="{timerEnabled}" onTick="tickCount++" />
|
|
284
|
+
<Button testId="restartButton" onClick="timerEnabled = false; timerEnabled = true">Restart</Button>
|
|
285
|
+
<Text testId="counter">{tickCount}</Text>
|
|
286
|
+
</Fragment>
|
|
287
|
+
`);
|
|
288
|
+
const counter = page.getByTestId("counter");
|
|
289
|
+
const restartButton = page.getByTestId("restartButton");
|
|
290
|
+
// Wait for the first tick
|
|
291
|
+
yield page.waitForTimeout(1200);
|
|
292
|
+
yield (0, fixtures_1.expect)(counter).toHaveText("1");
|
|
293
|
+
// Restart the timer
|
|
294
|
+
yield restartButton.click();
|
|
295
|
+
// Wait for another tick
|
|
296
|
+
yield page.waitForTimeout(1200);
|
|
297
|
+
yield (0, fixtures_1.expect)(counter).toHaveText("2");
|
|
298
|
+
}));
|
|
299
|
+
(0, fixtures_1.test)("once timer doesn't interfere with regular timer functionality", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
300
|
+
yield initTestBed(`
|
|
301
|
+
<Fragment var.tickCount="{0}">
|
|
302
|
+
<Timer interval="1000" once="false" onTick="tickCount++" />
|
|
303
|
+
<Text testId="counter">{tickCount}</Text>
|
|
304
|
+
</Fragment>
|
|
305
|
+
`);
|
|
306
|
+
const counter = page.getByTestId("counter");
|
|
307
|
+
// Wait for multiple ticks
|
|
308
|
+
yield page.waitForTimeout(3500);
|
|
309
|
+
const finalCount = parseInt((yield counter.textContent()) || "0");
|
|
310
|
+
(0, fixtures_1.expect)(finalCount).toBeGreaterThan(2);
|
|
311
|
+
}));
|
|
312
|
+
});
|
|
313
|
+
fixtures_1.test.describe("State Management", () => {
|
|
314
|
+
(0, fixtures_1.test)("timer can be dynamically enabled and disabled", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
315
|
+
yield initTestBed(`
|
|
316
|
+
<Fragment var.tickCount="{0}" var.timerEnabled="{false}">
|
|
317
|
+
<Timer interval="1000" enabled="{timerEnabled}" onTick="tickCount++" />
|
|
318
|
+
<Button testId="startButton" onClick="timerEnabled = true">Start Timer</Button>
|
|
319
|
+
<Button testId="stopButton" onClick="timerEnabled = false">Stop Timer</Button>
|
|
320
|
+
<Text testId="counter">{tickCount}</Text>
|
|
321
|
+
</Fragment>
|
|
322
|
+
`);
|
|
323
|
+
const counter = page.getByTestId("counter");
|
|
324
|
+
const startButton = page.getByTestId("startButton");
|
|
325
|
+
const stopButton = page.getByTestId("stopButton");
|
|
326
|
+
// Initially disabled - should not increment
|
|
327
|
+
yield page.waitForTimeout(1500);
|
|
328
|
+
yield (0, fixtures_1.expect)(counter).toHaveText("0");
|
|
329
|
+
// Start the timer
|
|
330
|
+
yield startButton.click();
|
|
331
|
+
yield page.waitForTimeout(1200);
|
|
332
|
+
yield (0, fixtures_1.expect)(counter).toHaveText("1");
|
|
333
|
+
// Stop the timer again
|
|
334
|
+
yield stopButton.click();
|
|
335
|
+
const currentCount = yield counter.textContent();
|
|
336
|
+
yield page.waitForTimeout(1500);
|
|
337
|
+
yield (0, fixtures_1.expect)(counter).toHaveText(currentCount || "1");
|
|
338
|
+
}));
|
|
339
|
+
(0, fixtures_1.test)("timer interval can be changed dynamically", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
340
|
+
yield initTestBed(`
|
|
341
|
+
<Fragment var.tickCount="{0}" var.timerInterval="{2000}">
|
|
342
|
+
<Timer interval="{timerInterval}" enabled="true" onTick="tickCount++" />
|
|
343
|
+
<Button testId="fasterButton" onClick="timerInterval = 500">Faster</Button>
|
|
344
|
+
<Text testId="counter">{tickCount}</Text>
|
|
345
|
+
</Fragment>
|
|
346
|
+
`);
|
|
347
|
+
const counter = page.getByTestId("counter");
|
|
348
|
+
const fasterButton = page.getByTestId("fasterButton");
|
|
349
|
+
// Start with 2000ms interval
|
|
350
|
+
yield page.waitForTimeout(2500);
|
|
351
|
+
yield (0, fixtures_1.expect)(counter).toHaveText("1");
|
|
352
|
+
// Change to 500ms interval
|
|
353
|
+
yield fasterButton.click();
|
|
354
|
+
yield page.waitForTimeout(1500); // Should get multiple ticks quickly
|
|
355
|
+
const finalCount = parseInt((yield counter.textContent()) || "0");
|
|
356
|
+
(0, fixtures_1.expect)(finalCount).toBeGreaterThan(1);
|
|
357
|
+
}));
|
|
358
|
+
});
|