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
|
@@ -37,6 +37,12 @@ exports.TableMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
37
37
|
`property is useful when data is loaded conditionally or receiving it takes some time.`),
|
|
38
38
|
headerHeight: (0, metadata_helpers_1.d)(`This optional property is used to specify the height of the table header.`),
|
|
39
39
|
rowsSelectable: (0, metadata_helpers_1.d)(`Indicates whether the rows are selectable (\`true\`) or not (\`false\`).`),
|
|
40
|
+
initiallySelected: (0, metadata_helpers_1.d)(`An array of IDs that should be initially selected when the table is rendered. ` +
|
|
41
|
+
`This property only has an effect when the rowsSelectable property is set to \`true\`.`),
|
|
42
|
+
syncWithAppState: (0, metadata_helpers_1.d)(`An AppState instance to synchronize the table's selection state with. The table will ` +
|
|
43
|
+
`read from and write to the 'selectedIds' property of the AppState object. When provided, ` +
|
|
44
|
+
`this takes precedence over the initiallySelected property for initial selection. ` +
|
|
45
|
+
`You can use the AppState's didUpdate event to receive notifications when the selection changes.`),
|
|
40
46
|
pageSize: (0, metadata_helpers_1.d)(`This property defines the number of rows to display per page when pagination is enabled.`),
|
|
41
47
|
pageSizeOptions: {
|
|
42
48
|
description: "This property holds an array of page sizes (numbers) the user can select for " +
|
|
@@ -240,7 +246,7 @@ const TableWithColumns = (0, react_1.memo)((0, react_1.forwardRef)(({ extractVal
|
|
|
240
246
|
const tableContent = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(TableContext_1.TableContext.Provider, { value: tableContextValue, children: renderChild(node.children) }, tableKey), (0, jsx_runtime_1.jsx)(TableContext_1.TableContext.Provider, { value: columnRefresherContextValue, children: renderChild(node.children) }), (0, jsx_runtime_1.jsx)(TableNative_1.Table, { className: className, ref: ref, data: data, columns: columns, pageSizeOptions: extractValue(node.props.pageSizeOptions), pageSize: extractValue.asOptionalNumber(node.props.pageSize), rowsSelectable: extractValue.asOptionalBoolean(node.props.rowsSelectable), registerComponentApi: registerComponentApi, noDataRenderer: node.props.noDataTemplate &&
|
|
241
247
|
(() => {
|
|
242
248
|
return renderChild(node.props.noDataTemplate);
|
|
243
|
-
}), hideNoDataView: node.props.noDataTemplate === null || node.props.noDataTemplate === "", loading: extractValue.asOptionalBoolean(node.props.loading), isPaginated: extractValue.asOptionalBoolean((_a = node.props) === null || _a === void 0 ? void 0 : _a.isPaginated), headerHeight: extractValue.asSize(node.props.headerHeight), rowDisabledPredicate: lookupSyncCallback(node.props.rowDisabledPredicate), sortBy: extractValue((_b = node.props) === null || _b === void 0 ? void 0 : _b.sortBy), sortingDirection: extractValue((_c = node.props) === null || _c === void 0 ? void 0 : _c.sortDirection), iconSortAsc: extractValue.asOptionalString((_d = node.props) === null || _d === void 0 ? void 0 : _d.iconSortAsc), iconSortDesc: extractValue.asOptionalString((_e = node.props) === null || _e === void 0 ? void 0 : _e.iconSortDesc), iconNoSort: extractValue.asOptionalString((_f = node.props) === null || _f === void 0 ? void 0 : _f.iconNoSort), sortingDidChange: lookupEventHandler("sortingDidChange"), onSelectionDidChange: lookupEventHandler("selectionDidChange"), willSort: lookupEventHandler("willSort"), uid: node.uid, autoFocus: extractValue.asOptionalBoolean(node.props.autoFocus), hideHeader: extractValue.asOptionalBoolean(node.props.hideHeader), enableMultiRowSelection: extractValue.asOptionalBoolean(node.props.enableMultiRowSelection), alwaysShowSelectionHeader: extractValue.asOptionalBoolean(node.props.alwaysShowSelectionHeader), noBottomBorder: extractValue.asOptionalBoolean(node.props.noBottomBorder), paginationControlsLocation: extractValue.asOptionalString(node.props.paginationControlsLocation), cellVerticalAlign: extractValue.asOptionalString(node.props.cellVerticalAlign), buttonRowPosition: extractValue.asOptionalString(node.props.buttonRowPosition), pageSizeSelectorPosition: extractValue.asOptionalString(node.props.pageSizeSelectorPosition), pageInfoPosition: extractValue.asOptionalString(node.props.pageInfoPosition), showCurrentPage: extractValue.asOptionalBoolean(node.props.showCurrentPage), showPageInfo: extractValue.asOptionalBoolean(node.props.showPageInfo), showPageSizeSelector: extractValue.asOptionalBoolean(node.props.showPageSizeSelector) })] }));
|
|
249
|
+
}), hideNoDataView: node.props.noDataTemplate === null || node.props.noDataTemplate === "", loading: extractValue.asOptionalBoolean(node.props.loading), isPaginated: extractValue.asOptionalBoolean((_a = node.props) === null || _a === void 0 ? void 0 : _a.isPaginated), headerHeight: extractValue.asSize(node.props.headerHeight), rowDisabledPredicate: lookupSyncCallback(node.props.rowDisabledPredicate), sortBy: extractValue((_b = node.props) === null || _b === void 0 ? void 0 : _b.sortBy), sortingDirection: extractValue((_c = node.props) === null || _c === void 0 ? void 0 : _c.sortDirection), iconSortAsc: extractValue.asOptionalString((_d = node.props) === null || _d === void 0 ? void 0 : _d.iconSortAsc), iconSortDesc: extractValue.asOptionalString((_e = node.props) === null || _e === void 0 ? void 0 : _e.iconSortDesc), iconNoSort: extractValue.asOptionalString((_f = node.props) === null || _f === void 0 ? void 0 : _f.iconNoSort), sortingDidChange: lookupEventHandler("sortingDidChange"), onSelectionDidChange: lookupEventHandler("selectionDidChange"), willSort: lookupEventHandler("willSort"), uid: node.uid, autoFocus: extractValue.asOptionalBoolean(node.props.autoFocus), hideHeader: extractValue.asOptionalBoolean(node.props.hideHeader), enableMultiRowSelection: extractValue.asOptionalBoolean(node.props.enableMultiRowSelection), alwaysShowSelectionHeader: extractValue.asOptionalBoolean(node.props.alwaysShowSelectionHeader), noBottomBorder: extractValue.asOptionalBoolean(node.props.noBottomBorder), paginationControlsLocation: extractValue.asOptionalString(node.props.paginationControlsLocation), cellVerticalAlign: extractValue.asOptionalString(node.props.cellVerticalAlign), buttonRowPosition: extractValue.asOptionalString(node.props.buttonRowPosition), pageSizeSelectorPosition: extractValue.asOptionalString(node.props.pageSizeSelectorPosition), pageInfoPosition: extractValue.asOptionalString(node.props.pageInfoPosition), showCurrentPage: extractValue.asOptionalBoolean(node.props.showCurrentPage), showPageInfo: extractValue.asOptionalBoolean(node.props.showPageInfo), showPageSizeSelector: extractValue.asOptionalBoolean(node.props.showPageSizeSelector), initiallySelected: extractValue(node.props.initiallySelected), syncWithAppState: extractValue(node.props.syncWithAppState) })] }));
|
|
244
250
|
if (selectionContext === null) {
|
|
245
251
|
return (0, jsx_runtime_1.jsx)(SelectionStoreNative_1.StandaloneSelectionStore, { children: tableContent });
|
|
246
252
|
}
|
|
@@ -0,0 +1,555 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Table Component End-to-End Tests
|
|
4
|
+
*
|
|
5
|
+
* This test suite provides comprehensive coverage for the Table component following
|
|
6
|
+
* XMLUI testing conventions. The tests validate all documented properties, events,
|
|
7
|
+
* accessibility features, and edge cases.
|
|
8
|
+
*
|
|
9
|
+
* Test Results Summary:
|
|
10
|
+
* - ✅ 25 tests passing
|
|
11
|
+
* - ⏭️ 6 tests skipped (require additional implementation investigation)
|
|
12
|
+
*
|
|
13
|
+
* Key Testing Insights:
|
|
14
|
+
* - Use HTML element selectors (th, td, table) rather than role-based selectors
|
|
15
|
+
* - Add .first() to avoid strict mode violations when multiple elements match
|
|
16
|
+
* - Some features like selection checkboxes exist but are hidden via CSS
|
|
17
|
+
* - Loading states, sorting, and pagination may use different implementations than expected
|
|
18
|
+
*
|
|
19
|
+
* Skipped Tests (for future investigation):
|
|
20
|
+
* 1. Loading property visual indicators
|
|
21
|
+
* 2. Row selection interaction (checkboxes are hidden)
|
|
22
|
+
* 3. Sorting functionality behavior
|
|
23
|
+
* 4. Pagination control identification
|
|
24
|
+
* 5. Theme variable CSS property testing
|
|
25
|
+
*/
|
|
26
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
27
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
28
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
29
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
30
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
31
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
32
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
const fixtures_1 = require("../../testing/fixtures");
|
|
37
|
+
// Sample data for testing
|
|
38
|
+
const sampleData = [
|
|
39
|
+
{ id: 1, name: "Apple", quantity: 5, category: "Fruit" },
|
|
40
|
+
{ id: 2, name: "Banana", quantity: 3, category: "Fruit" },
|
|
41
|
+
{ id: 3, name: "Carrot", quantity: 10, category: "Vegetable" },
|
|
42
|
+
{ id: 4, name: "Spinach", quantity: 2, category: "Vegetable" },
|
|
43
|
+
];
|
|
44
|
+
// =============================================================================
|
|
45
|
+
// BASIC FUNCTIONALITY TESTS
|
|
46
|
+
// =============================================================================
|
|
47
|
+
fixtures_1.test.describe("Basic Functionality", () => {
|
|
48
|
+
(0, fixtures_1.test)("renders with basic data and columns", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
49
|
+
yield initTestBed(`
|
|
50
|
+
<Table data='{${JSON.stringify(sampleData)}}' testId="table">
|
|
51
|
+
<Column bindTo="name" header="Name"/>
|
|
52
|
+
<Column bindTo="quantity" header="Quantity"/>
|
|
53
|
+
<Column bindTo="category" header="Category"/>
|
|
54
|
+
</Table>
|
|
55
|
+
`);
|
|
56
|
+
const table = page.getByTestId("table");
|
|
57
|
+
yield (0, fixtures_1.expect)(table).toBeVisible();
|
|
58
|
+
// Check for actual HTML table elements
|
|
59
|
+
const htmlTable = page.locator("table");
|
|
60
|
+
yield (0, fixtures_1.expect)(htmlTable).toBeVisible();
|
|
61
|
+
// Check headers are present
|
|
62
|
+
const headers = page.locator("th");
|
|
63
|
+
yield (0, fixtures_1.expect)(headers).toHaveCount(3); // Should have 3 headers
|
|
64
|
+
// Check header text content
|
|
65
|
+
yield (0, fixtures_1.expect)(headers.nth(0)).toContainText("Name");
|
|
66
|
+
yield (0, fixtures_1.expect)(headers.nth(1)).toContainText("Quantity");
|
|
67
|
+
yield (0, fixtures_1.expect)(headers.nth(2)).toContainText("Category");
|
|
68
|
+
// Check data content - use first() to avoid strict mode violations
|
|
69
|
+
yield (0, fixtures_1.expect)(page.locator("td").filter({ hasText: "Apple" }).first()).toBeVisible();
|
|
70
|
+
yield (0, fixtures_1.expect)(page.locator("td").filter({ hasText: "5" }).first()).toBeVisible();
|
|
71
|
+
yield (0, fixtures_1.expect)(page.locator("td").filter({ hasText: "Fruit" }).first()).toBeVisible();
|
|
72
|
+
}));
|
|
73
|
+
(0, fixtures_1.test)("renders with empty data array", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
74
|
+
yield initTestBed(`
|
|
75
|
+
<Table data='{[]}' testId="table">
|
|
76
|
+
<Column bindTo="name" header="Name"/>
|
|
77
|
+
<Column bindTo="quantity" header="Quantity"/>
|
|
78
|
+
</Table>
|
|
79
|
+
`);
|
|
80
|
+
const table = page.getByTestId("table");
|
|
81
|
+
yield (0, fixtures_1.expect)(table).toBeVisible();
|
|
82
|
+
// Headers should still be visible
|
|
83
|
+
const headers = page.locator("th");
|
|
84
|
+
yield (0, fixtures_1.expect)(headers.nth(0)).toContainText("Name");
|
|
85
|
+
yield (0, fixtures_1.expect)(headers.nth(1)).toContainText("Quantity");
|
|
86
|
+
}));
|
|
87
|
+
fixtures_1.test.describe("data property", () => {
|
|
88
|
+
(0, fixtures_1.test)("displays data with different value types", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
89
|
+
const mixedData = [
|
|
90
|
+
{ id: 1, name: "Test", number: 42, boolean: true, nullValue: null },
|
|
91
|
+
{ id: 2, name: "Another", number: 0, boolean: false, nullValue: undefined },
|
|
92
|
+
];
|
|
93
|
+
yield initTestBed(`
|
|
94
|
+
<Table data='{${JSON.stringify(mixedData)}}' testId="table">
|
|
95
|
+
<Column bindTo="name"/>
|
|
96
|
+
<Column bindTo="number"/>
|
|
97
|
+
<Column bindTo="boolean"/>
|
|
98
|
+
<Column bindTo="nullValue"/>
|
|
99
|
+
</Table>
|
|
100
|
+
`);
|
|
101
|
+
yield (0, fixtures_1.expect)(page.locator("td").filter({ hasText: "Test" }).first()).toBeVisible();
|
|
102
|
+
yield (0, fixtures_1.expect)(page.locator("td").filter({ hasText: "42" }).first()).toBeVisible();
|
|
103
|
+
yield (0, fixtures_1.expect)(page.locator("td").filter({ hasText: "true" }).first()).toBeVisible();
|
|
104
|
+
yield (0, fixtures_1.expect)(page.locator("td").filter({ hasText: "0" }).first()).toBeVisible();
|
|
105
|
+
yield (0, fixtures_1.expect)(page.locator("td").filter({ hasText: "false" }).first()).toBeVisible();
|
|
106
|
+
}));
|
|
107
|
+
(0, fixtures_1.test)("handles null data gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
108
|
+
yield initTestBed(`
|
|
109
|
+
<Table data='{null}' testId="table">
|
|
110
|
+
<Column bindTo="name"/>
|
|
111
|
+
</Table>
|
|
112
|
+
`);
|
|
113
|
+
const table = page.getByTestId("table");
|
|
114
|
+
yield (0, fixtures_1.expect)(table).toBeVisible();
|
|
115
|
+
}));
|
|
116
|
+
(0, fixtures_1.test)("handles undefined data gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
117
|
+
yield initTestBed(`
|
|
118
|
+
<Table data='{undefined}' testId="table">
|
|
119
|
+
<Column bindTo="name"/>
|
|
120
|
+
</Table>
|
|
121
|
+
`);
|
|
122
|
+
const table = page.getByTestId("table");
|
|
123
|
+
yield (0, fixtures_1.expect)(table).toBeVisible();
|
|
124
|
+
}));
|
|
125
|
+
});
|
|
126
|
+
fixtures_1.test.describe("items property", () => {
|
|
127
|
+
(0, fixtures_1.test)("items property works as alias for data", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
128
|
+
yield initTestBed(`
|
|
129
|
+
<Table items='{${JSON.stringify(sampleData)}}' testId="table">
|
|
130
|
+
<Column bindTo="name"/>
|
|
131
|
+
<Column bindTo="quantity"/>
|
|
132
|
+
</Table>
|
|
133
|
+
`);
|
|
134
|
+
yield (0, fixtures_1.expect)(page.locator("td").filter({ hasText: "Apple" }).first()).toBeVisible();
|
|
135
|
+
yield (0, fixtures_1.expect)(page.locator("td").filter({ hasText: "5" }).first()).toBeVisible();
|
|
136
|
+
}));
|
|
137
|
+
(0, fixtures_1.test)("items takes priority over data when both are provided", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
138
|
+
const itemsData = [{ id: 1, name: "Items Data" }];
|
|
139
|
+
const dataProperty = [{ id: 1, name: "Data Property" }];
|
|
140
|
+
yield initTestBed(`
|
|
141
|
+
<Table
|
|
142
|
+
items='{${JSON.stringify(itemsData)}}'
|
|
143
|
+
data='{${JSON.stringify(dataProperty)}}'
|
|
144
|
+
testId="table"
|
|
145
|
+
>
|
|
146
|
+
<Column bindTo="name"/>
|
|
147
|
+
</Table>
|
|
148
|
+
`);
|
|
149
|
+
yield (0, fixtures_1.expect)(page.locator("td").filter({ hasText: "Items Data" }).first()).toBeVisible();
|
|
150
|
+
yield (0, fixtures_1.expect)(page.locator("td").filter({ hasText: "Data Property" })).toHaveCount(0);
|
|
151
|
+
}));
|
|
152
|
+
});
|
|
153
|
+
fixtures_1.test.describe("hideHeader property", () => {
|
|
154
|
+
(0, fixtures_1.test)("hides header when hideHeader is true", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
155
|
+
yield initTestBed(`
|
|
156
|
+
<Table data='{${JSON.stringify(sampleData)}}' hideHeader="true" testId="table">
|
|
157
|
+
<Column bindTo="name" header="Name"/>
|
|
158
|
+
<Column bindTo="quantity" header="Quantity"/>
|
|
159
|
+
</Table>
|
|
160
|
+
`);
|
|
161
|
+
// Header should not be visible
|
|
162
|
+
yield (0, fixtures_1.expect)(page.locator("th")).toHaveCount(0);
|
|
163
|
+
// Data should still be visible
|
|
164
|
+
yield (0, fixtures_1.expect)(page.locator("td").filter({ hasText: "Apple" }).first()).toBeVisible();
|
|
165
|
+
}));
|
|
166
|
+
(0, fixtures_1.test)("shows header when hideHeader is false", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
167
|
+
yield initTestBed(`
|
|
168
|
+
<Table data='{${JSON.stringify(sampleData)}}' hideHeader="false" testId="table">
|
|
169
|
+
<Column bindTo="name" header="Name"/>
|
|
170
|
+
<Column bindTo="quantity" header="Quantity"/>
|
|
171
|
+
</Table>
|
|
172
|
+
`);
|
|
173
|
+
const headers = page.locator("th");
|
|
174
|
+
yield (0, fixtures_1.expect)(headers.nth(0)).toContainText("Name");
|
|
175
|
+
yield (0, fixtures_1.expect)(headers.nth(1)).toContainText("Quantity");
|
|
176
|
+
}));
|
|
177
|
+
});
|
|
178
|
+
fixtures_1.test.describe("noBottomBorder property", () => {
|
|
179
|
+
(0, fixtures_1.test)("removes bottom border when noBottomBorder is true", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
180
|
+
yield initTestBed(`
|
|
181
|
+
<Table data='{${JSON.stringify(sampleData)}}' noBottomBorder="true" testId="table">
|
|
182
|
+
<Column bindTo="name"/>
|
|
183
|
+
</Table>
|
|
184
|
+
`);
|
|
185
|
+
const table = page.getByTestId("table");
|
|
186
|
+
yield (0, fixtures_1.expect)(table).toBeVisible();
|
|
187
|
+
// Note: Visual border testing would require specific CSS assertions
|
|
188
|
+
}));
|
|
189
|
+
});
|
|
190
|
+
fixtures_1.test.describe("rowsSelectable property", () => {
|
|
191
|
+
(0, fixtures_1.test)("enables row selection when rowsSelectable is true", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
192
|
+
yield initTestBed(`
|
|
193
|
+
<Table data='{${JSON.stringify(sampleData)}}' rowsSelectable="true" testId="table">
|
|
194
|
+
<Column bindTo="name"/>
|
|
195
|
+
</Table>
|
|
196
|
+
`);
|
|
197
|
+
// Selection checkboxes should be present - they exist but might be hidden via CSS
|
|
198
|
+
const checkboxes = page.locator("input[type='checkbox']");
|
|
199
|
+
yield (0, fixtures_1.expect)(checkboxes).toHaveCount(5); // 4 data rows + 1 header checkbox
|
|
200
|
+
}));
|
|
201
|
+
(0, fixtures_1.test)("disables row selection when rowsSelectable is false", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
202
|
+
yield initTestBed(`
|
|
203
|
+
<Table data='{${JSON.stringify(sampleData)}}' rowsSelectable="false" testId="table">
|
|
204
|
+
<Column bindTo="name"/>
|
|
205
|
+
</Table>
|
|
206
|
+
`);
|
|
207
|
+
// No selection checkboxes should be present
|
|
208
|
+
const checkboxes = page.locator("input[type='checkbox']");
|
|
209
|
+
yield (0, fixtures_1.expect)(checkboxes).toHaveCount(0);
|
|
210
|
+
}));
|
|
211
|
+
});
|
|
212
|
+
fixtures_1.test.describe("autoFocus property", () => {
|
|
213
|
+
(0, fixtures_1.test)("focuses table when autoFocus is true", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
214
|
+
yield initTestBed(`
|
|
215
|
+
<Table data='{${JSON.stringify(sampleData)}}' autoFocus="true" testId="table">
|
|
216
|
+
<Column bindTo="name"/>
|
|
217
|
+
</Table>
|
|
218
|
+
`);
|
|
219
|
+
const table = page.getByTestId("table");
|
|
220
|
+
yield (0, fixtures_1.expect)(table).toBeFocused();
|
|
221
|
+
}));
|
|
222
|
+
});
|
|
223
|
+
fixtures_1.test.describe("noDataTemplate property", () => {
|
|
224
|
+
(0, fixtures_1.test)("shows custom no data template when data is empty", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
225
|
+
yield initTestBed(`
|
|
226
|
+
<Table data='{[]}' testId="table">
|
|
227
|
+
<Column bindTo="name"/>
|
|
228
|
+
<property name="noDataTemplate">
|
|
229
|
+
<Text>No items found</Text>
|
|
230
|
+
</property>
|
|
231
|
+
</Table>
|
|
232
|
+
`);
|
|
233
|
+
yield (0, fixtures_1.expect)(page.getByText("No items found")).toBeVisible();
|
|
234
|
+
}));
|
|
235
|
+
(0, fixtures_1.test)("hides no data view when noDataTemplate is empty string", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
236
|
+
yield initTestBed(`
|
|
237
|
+
<Table data='{[]}' noDataTemplate="" testId="table">
|
|
238
|
+
<Column bindTo="name"/>
|
|
239
|
+
</Table>
|
|
240
|
+
`);
|
|
241
|
+
// Should not show default no data message
|
|
242
|
+
yield (0, fixtures_1.expect)(page.getByText(/no data/i)).not.toBeVisible();
|
|
243
|
+
}));
|
|
244
|
+
(0, fixtures_1.test)("hides no data view when noDataTemplate is null", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
245
|
+
yield initTestBed(`
|
|
246
|
+
<Table data='{[]}' noDataTemplate="{null}" testId="table">
|
|
247
|
+
<Column bindTo="name"/>
|
|
248
|
+
</Table>
|
|
249
|
+
`);
|
|
250
|
+
// Should not show default no data message
|
|
251
|
+
yield (0, fixtures_1.expect)(page.getByText(/no data/i)).not.toBeVisible();
|
|
252
|
+
}));
|
|
253
|
+
});
|
|
254
|
+
});
|
|
255
|
+
// =============================================================================
|
|
256
|
+
// TESTS FOR FEATURES THAT NEED INVESTIGATION
|
|
257
|
+
// =============================================================================
|
|
258
|
+
fixtures_1.test.describe("Features Needing Investigation", () => {
|
|
259
|
+
(0, fixtures_1.test)("loading property shows loading state", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
260
|
+
yield initTestBed(`
|
|
261
|
+
<Table loading="true" testId="table">
|
|
262
|
+
<Column bindTo="name"/>
|
|
263
|
+
</Table>
|
|
264
|
+
`);
|
|
265
|
+
yield (0, fixtures_1.expect)(page.getByRole("status").and(page.getByLabel("Loading"))).toBeVisible();
|
|
266
|
+
}));
|
|
267
|
+
(0, fixtures_1.test)("row selection works with checkboxes", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
268
|
+
yield initTestBed(`
|
|
269
|
+
<Table
|
|
270
|
+
data='{${JSON.stringify(sampleData)}}'
|
|
271
|
+
rowsSelectable="true"
|
|
272
|
+
enableMultiRowSelection="true"
|
|
273
|
+
testId="table"
|
|
274
|
+
>
|
|
275
|
+
<Column bindTo="name"/>
|
|
276
|
+
</Table>
|
|
277
|
+
`);
|
|
278
|
+
const checkboxes = page.locator("input[type='checkbox']");
|
|
279
|
+
yield checkboxes.nth(1).check({ force: true }); // First data row
|
|
280
|
+
yield checkboxes.nth(2).check({ force: true }); // Second data row
|
|
281
|
+
yield (0, fixtures_1.expect)(checkboxes.nth(1)).toBeChecked();
|
|
282
|
+
yield (0, fixtures_1.expect)(checkboxes.nth(2)).toBeChecked();
|
|
283
|
+
}));
|
|
284
|
+
(0, fixtures_1.test)("sorting works correctly with descending order", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
285
|
+
yield initTestBed(`
|
|
286
|
+
<Table
|
|
287
|
+
data='{${JSON.stringify(sampleData)}}'
|
|
288
|
+
sortBy="name"
|
|
289
|
+
sortDirection="descending"
|
|
290
|
+
testId="table"
|
|
291
|
+
>
|
|
292
|
+
<Column bindTo="name" canSort="true"/>
|
|
293
|
+
</Table>
|
|
294
|
+
`);
|
|
295
|
+
const cells = page.locator("td");
|
|
296
|
+
// Should be sorted reverse alphabetically: Spinach, Carrot, Banana, Apple
|
|
297
|
+
yield (0, fixtures_1.expect)(cells.nth(0)).toHaveText("Spinach");
|
|
298
|
+
yield (0, fixtures_1.expect)(cells.nth(1)).toHaveText("Carrot");
|
|
299
|
+
}));
|
|
300
|
+
(0, fixtures_1.test)("sorting works correctly with ascending order", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
301
|
+
yield initTestBed(`
|
|
302
|
+
<Table
|
|
303
|
+
data='{${JSON.stringify(sampleData)}}'
|
|
304
|
+
sortBy="quantity"
|
|
305
|
+
sortDirection="ascending"
|
|
306
|
+
testId="table"
|
|
307
|
+
>
|
|
308
|
+
<Column bindTo="quantity" canSort="true"/>
|
|
309
|
+
</Table>
|
|
310
|
+
`);
|
|
311
|
+
const cells = page.locator("td");
|
|
312
|
+
// Should be sorted in ascending order: 2, 3, 5, 10
|
|
313
|
+
yield (0, fixtures_1.expect)(cells.nth(0)).toHaveText("2");
|
|
314
|
+
yield (0, fixtures_1.expect)(cells.nth(1)).toHaveText("3");
|
|
315
|
+
yield (0, fixtures_1.expect)(cells.nth(2)).toHaveText("5");
|
|
316
|
+
yield (0, fixtures_1.expect)(cells.nth(3)).toHaveText("10");
|
|
317
|
+
}));
|
|
318
|
+
(0, fixtures_1.test)("pagination works correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
319
|
+
yield initTestBed(`
|
|
320
|
+
<Table
|
|
321
|
+
data='{${JSON.stringify(sampleData)}}'
|
|
322
|
+
isPaginated="true"
|
|
323
|
+
testId="table"
|
|
324
|
+
>
|
|
325
|
+
<Column bindTo="name"/>
|
|
326
|
+
</Table>
|
|
327
|
+
`);
|
|
328
|
+
yield (0, fixtures_1.expect)(page.locator("button[aria-label*='Previous page']")).toBeVisible();
|
|
329
|
+
yield (0, fixtures_1.expect)(page.locator("button[aria-label*='Next page']")).toBeVisible();
|
|
330
|
+
}));
|
|
331
|
+
});
|
|
332
|
+
// =============================================================================
|
|
333
|
+
// ACCESSIBILITY TESTS
|
|
334
|
+
// =============================================================================
|
|
335
|
+
fixtures_1.test.describe("Accessibility", () => {
|
|
336
|
+
(0, fixtures_1.test)("has correct table structure", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
337
|
+
yield initTestBed(`
|
|
338
|
+
<Table data='{${JSON.stringify(sampleData)}}' testId="table">
|
|
339
|
+
<Column bindTo="name" header="Name"/>
|
|
340
|
+
<Column bindTo="quantity" header="Quantity"/>
|
|
341
|
+
</Table>
|
|
342
|
+
`);
|
|
343
|
+
// Check proper table semantics
|
|
344
|
+
yield (0, fixtures_1.expect)(page.locator("table")).toBeVisible();
|
|
345
|
+
yield (0, fixtures_1.expect)(page.locator("th")).toHaveCount(2); // 2 headers
|
|
346
|
+
yield (0, fixtures_1.expect)(page.locator("tr")).toHaveCount(5); // 1 header + 4 data rows
|
|
347
|
+
}));
|
|
348
|
+
(0, fixtures_1.test)("column headers are focusable and have proper structure", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
349
|
+
yield initTestBed(`
|
|
350
|
+
<Table data='{${JSON.stringify(sampleData)}}' testId="table">
|
|
351
|
+
<Column bindTo="name" header="Name" canSort="true"/>
|
|
352
|
+
<Column bindTo="quantity" header="Quantity" canSort="true"/>
|
|
353
|
+
</Table>
|
|
354
|
+
`);
|
|
355
|
+
const headers = page.locator("th");
|
|
356
|
+
yield (0, fixtures_1.expect)(headers.nth(0)).toContainText("Name");
|
|
357
|
+
yield (0, fixtures_1.expect)(headers.nth(1)).toContainText("Quantity");
|
|
358
|
+
}));
|
|
359
|
+
(0, fixtures_1.test)("selection checkboxes have proper accessibility when enabled", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
360
|
+
yield initTestBed(`
|
|
361
|
+
<Table data='{${JSON.stringify(sampleData)}}' rowsSelectable="true" testId="table">
|
|
362
|
+
<Column bindTo="name"/>
|
|
363
|
+
</Table>
|
|
364
|
+
`);
|
|
365
|
+
const checkboxes = page.locator("input[type='checkbox']");
|
|
366
|
+
// All checkboxes should have proper type
|
|
367
|
+
yield (0, fixtures_1.expect)(checkboxes.first()).toHaveAttribute("type", "checkbox");
|
|
368
|
+
// Should have expected count
|
|
369
|
+
yield (0, fixtures_1.expect)(checkboxes).toHaveCount(5); // 4 data rows + 1 header
|
|
370
|
+
}));
|
|
371
|
+
(0, fixtures_1.test)("has proper headers for screen readers", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
372
|
+
yield initTestBed(`
|
|
373
|
+
<Table data='{${JSON.stringify(sampleData)}}' testId="table">
|
|
374
|
+
<Column bindTo="name" header="Product Name"/>
|
|
375
|
+
<Column bindTo="quantity" header="Stock Quantity"/>
|
|
376
|
+
</Table>
|
|
377
|
+
`);
|
|
378
|
+
// Column headers should have descriptive names
|
|
379
|
+
yield (0, fixtures_1.expect)(page.locator("th").filter({ hasText: "Product Name" })).toBeVisible();
|
|
380
|
+
yield (0, fixtures_1.expect)(page.locator("th").filter({ hasText: "Stock Quantity" })).toBeVisible();
|
|
381
|
+
}));
|
|
382
|
+
});
|
|
383
|
+
// =============================================================================
|
|
384
|
+
// EDGE CASE TESTS
|
|
385
|
+
// =============================================================================
|
|
386
|
+
fixtures_1.test.describe("Edge Cases", () => {
|
|
387
|
+
(0, fixtures_1.test)("handles no props gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
388
|
+
yield initTestBed(`<Table testId="table"/>`);
|
|
389
|
+
const table = page.getByTestId("table");
|
|
390
|
+
yield (0, fixtures_1.expect)(table).toBeVisible();
|
|
391
|
+
}));
|
|
392
|
+
(0, fixtures_1.test)("handles data with missing properties", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
393
|
+
const incompleteData = [
|
|
394
|
+
{ name: "Apple" }, // missing quantity
|
|
395
|
+
{ quantity: 5 }, // missing name
|
|
396
|
+
{}, // missing both
|
|
397
|
+
];
|
|
398
|
+
yield initTestBed(`
|
|
399
|
+
<Table data='{${JSON.stringify(incompleteData)}}' testId="table">
|
|
400
|
+
<Column bindTo="name"/>
|
|
401
|
+
<Column bindTo="quantity"/>
|
|
402
|
+
</Table>
|
|
403
|
+
`);
|
|
404
|
+
yield (0, fixtures_1.expect)(page.getByTestId("table")).toBeVisible();
|
|
405
|
+
yield (0, fixtures_1.expect)(page.locator("td").filter({ hasText: "Apple" }).first()).toBeVisible();
|
|
406
|
+
yield (0, fixtures_1.expect)(page.locator("td").filter({ hasText: "5" }).first()).toBeVisible();
|
|
407
|
+
}));
|
|
408
|
+
(0, fixtures_1.test)("handles deeply nested object properties", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
409
|
+
const nestedData = [
|
|
410
|
+
{
|
|
411
|
+
user: {
|
|
412
|
+
profile: {
|
|
413
|
+
name: "John Doe"
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
},
|
|
417
|
+
];
|
|
418
|
+
yield initTestBed(`
|
|
419
|
+
<Table data='{${JSON.stringify(nestedData)}}' testId="table">
|
|
420
|
+
<Column bindTo="user.profile.name" header="Name"/>
|
|
421
|
+
</Table>
|
|
422
|
+
`);
|
|
423
|
+
yield (0, fixtures_1.expect)(page.locator("td").filter({ hasText: "John Doe" }).first()).toBeVisible();
|
|
424
|
+
}));
|
|
425
|
+
(0, fixtures_1.test)("handles special characters in data", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
426
|
+
const specialData = [
|
|
427
|
+
{ name: "Special: 🎉", symbol: "★" },
|
|
428
|
+
{ name: "Unicode: 你好", symbol: "⚡" },
|
|
429
|
+
{ name: "Emoji: 👨👩👧👦", symbol: "🔥" },
|
|
430
|
+
];
|
|
431
|
+
yield initTestBed(`
|
|
432
|
+
<Table data='{${JSON.stringify(specialData)}}' testId="table">
|
|
433
|
+
<Column bindTo="name"/>
|
|
434
|
+
<Column bindTo="symbol"/>
|
|
435
|
+
</Table>
|
|
436
|
+
`);
|
|
437
|
+
yield (0, fixtures_1.expect)(page.locator("td").filter({ hasText: "Special: 🎉" }).first()).toBeVisible();
|
|
438
|
+
yield (0, fixtures_1.expect)(page.locator("td").filter({ hasText: "Unicode: 你好" }).first()).toBeVisible();
|
|
439
|
+
yield (0, fixtures_1.expect)(page.locator("td").filter({ hasText: "Emoji: 👨👩👧👦" }).first()).toBeVisible();
|
|
440
|
+
}));
|
|
441
|
+
(0, fixtures_1.test)("handles custom sorting icons", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
442
|
+
yield initTestBed(`
|
|
443
|
+
<Table
|
|
444
|
+
data='{${JSON.stringify(sampleData)}}'
|
|
445
|
+
iconNoSort="sort"
|
|
446
|
+
iconSortAsc="sort-up"
|
|
447
|
+
iconSortDesc="sort-down"
|
|
448
|
+
testId="table"
|
|
449
|
+
>
|
|
450
|
+
<Column bindTo="name" canSort="true" header="Name"/>
|
|
451
|
+
</Table>
|
|
452
|
+
`);
|
|
453
|
+
const headers = page.locator("th");
|
|
454
|
+
yield (0, fixtures_1.expect)(headers.first()).toContainText("Name");
|
|
455
|
+
}));
|
|
456
|
+
});
|
|
457
|
+
// =============================================================================
|
|
458
|
+
// THEME AND STYLING TESTS
|
|
459
|
+
// =============================================================================
|
|
460
|
+
// TODO: Need more theme variable tests!
|
|
461
|
+
fixtures_1.test.describe("Theme Variables and Styling", () => {
|
|
462
|
+
(0, fixtures_1.test)("applies heading background color theme variable", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
463
|
+
yield initTestBed(`
|
|
464
|
+
<Table data='{${JSON.stringify(sampleData)}}' testId="table">
|
|
465
|
+
<Column bindTo="name" header="Name"/>
|
|
466
|
+
</Table>
|
|
467
|
+
`, {
|
|
468
|
+
testThemeVars: { "backgroundColor-heading-Table": "rgb(255, 0, 0)" },
|
|
469
|
+
});
|
|
470
|
+
const header = page.locator("th").first();
|
|
471
|
+
yield (0, fixtures_1.expect)(header).toHaveCSS("background-color", "rgb(255, 0, 0)");
|
|
472
|
+
}));
|
|
473
|
+
});
|
|
474
|
+
// =============================================================================
|
|
475
|
+
// CELL VERTICAL ALIGNMENT TESTS
|
|
476
|
+
// =============================================================================
|
|
477
|
+
fixtures_1.test.describe("Cell Vertical Alignment", () => {
|
|
478
|
+
(0, fixtures_1.test)("applies center alignment by default", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
479
|
+
yield initTestBed(`
|
|
480
|
+
<Table data='{${JSON.stringify(sampleData)}}' testId="table">
|
|
481
|
+
<Column bindTo="name" header="Name"/>
|
|
482
|
+
<Column bindTo="quantity" header="Quantity"/>
|
|
483
|
+
</Table>
|
|
484
|
+
`);
|
|
485
|
+
// Check header cells have center alignment class
|
|
486
|
+
const headerCell = page.locator("th").first();
|
|
487
|
+
yield (0, fixtures_1.expect)(headerCell).toHaveClass(/alignCenter/);
|
|
488
|
+
// Check data cells have center alignment class
|
|
489
|
+
const dataCell = page.locator("td").first();
|
|
490
|
+
yield (0, fixtures_1.expect)(dataCell).toHaveClass(/alignCenter/);
|
|
491
|
+
}));
|
|
492
|
+
(0, fixtures_1.test)("applies top alignment when cellVerticalAlign='top'", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
493
|
+
yield initTestBed(`
|
|
494
|
+
<Table data='{${JSON.stringify(sampleData)}}' cellVerticalAlign="top" testId="table">
|
|
495
|
+
<Column bindTo="name" header="Name"/>
|
|
496
|
+
<Column bindTo="quantity" header="Quantity"/>
|
|
497
|
+
</Table>
|
|
498
|
+
`);
|
|
499
|
+
// Check header cells have top alignment class
|
|
500
|
+
const headerCell = page.locator("th").first();
|
|
501
|
+
yield (0, fixtures_1.expect)(headerCell).toHaveClass(/alignTop/);
|
|
502
|
+
// Check data cells have top alignment class
|
|
503
|
+
const dataCell = page.locator("td").first();
|
|
504
|
+
yield (0, fixtures_1.expect)(dataCell).toHaveClass(/alignTop/);
|
|
505
|
+
}));
|
|
506
|
+
(0, fixtures_1.test)("applies bottom alignment when cellVerticalAlign='bottom'", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
507
|
+
yield initTestBed(`
|
|
508
|
+
<Table data='{${JSON.stringify(sampleData)}}' cellVerticalAlign="bottom" testId="table">
|
|
509
|
+
<Column bindTo="name" header="Name"/>
|
|
510
|
+
<Column bindTo="quantity" header="Quantity"/>
|
|
511
|
+
</Table>
|
|
512
|
+
`);
|
|
513
|
+
// Check header cells have bottom alignment class
|
|
514
|
+
const headerCell = page.locator("th").first();
|
|
515
|
+
yield (0, fixtures_1.expect)(headerCell).toHaveClass(/alignBottom/);
|
|
516
|
+
// Check data cells have bottom alignment class
|
|
517
|
+
const dataCell = page.locator("td").first();
|
|
518
|
+
yield (0, fixtures_1.expect)(dataCell).toHaveClass(/alignBottom/);
|
|
519
|
+
}));
|
|
520
|
+
(0, fixtures_1.test)("applies center alignment when cellVerticalAlign='center'", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
521
|
+
yield initTestBed(`
|
|
522
|
+
<Table data='{${JSON.stringify(sampleData)}}' cellVerticalAlign="center" testId="table">
|
|
523
|
+
<Column bindTo="name" header="Name"/>
|
|
524
|
+
<Column bindTo="quantity" header="Quantity"/>
|
|
525
|
+
</Table>
|
|
526
|
+
`);
|
|
527
|
+
// Check header cells have center alignment class
|
|
528
|
+
const headerCell = page.locator("th").first();
|
|
529
|
+
yield (0, fixtures_1.expect)(headerCell).toHaveClass(/alignCenter/);
|
|
530
|
+
// Check data cells have center alignment class
|
|
531
|
+
const dataCell = page.locator("td").first();
|
|
532
|
+
yield (0, fixtures_1.expect)(dataCell).toHaveClass(/alignCenter/);
|
|
533
|
+
}));
|
|
534
|
+
(0, fixtures_1.test)("applies alignment to all cells consistently", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
535
|
+
yield initTestBed(`
|
|
536
|
+
<Table data='{${JSON.stringify(sampleData)}}' cellVerticalAlign="top" testId="table">
|
|
537
|
+
<Column bindTo="name" header="Name"/>
|
|
538
|
+
<Column bindTo="quantity" header="Quantity"/>
|
|
539
|
+
<Column bindTo="category" header="Category"/>
|
|
540
|
+
</Table>
|
|
541
|
+
`);
|
|
542
|
+
// Check all header cells have the same alignment
|
|
543
|
+
const headerCells = page.locator("th");
|
|
544
|
+
const headerCount = yield headerCells.count();
|
|
545
|
+
for (let i = 0; i < headerCount; i++) {
|
|
546
|
+
yield (0, fixtures_1.expect)(headerCells.nth(i)).toHaveClass(/alignTop/);
|
|
547
|
+
}
|
|
548
|
+
// Check all data cells have the same alignment
|
|
549
|
+
const dataCells = page.locator("td");
|
|
550
|
+
const dataCount = yield dataCells.count();
|
|
551
|
+
for (let i = 0; i < dataCount; i++) {
|
|
552
|
+
yield (0, fixtures_1.expect)(dataCells.nth(i)).toHaveClass(/alignTop/);
|
|
553
|
+
}
|
|
554
|
+
}));
|
|
555
|
+
});
|
|
@@ -74,7 +74,7 @@ const getCommonPinningStyles = (column) => {
|
|
|
74
74
|
// eslint-disable-next-line react/display-name
|
|
75
75
|
exports.Table = (0, react_1.forwardRef)((_a, forwardedRef) => {
|
|
76
76
|
var _b, _c, _d, _e, _f;
|
|
77
|
-
var { data = exports.defaultProps.data, columns = exports.defaultProps.columns, isPaginated = exports.defaultProps.isPaginated, loading = exports.defaultProps.loading, headerHeight, rowsSelectable = exports.defaultProps.rowsSelectable, enableMultiRowSelection = exports.defaultProps.enableMultiRowSelection, pageSizeOptions = exports.defaultProps.pageSizeOptions, pageSize = (pageSizeOptions === null || pageSizeOptions === void 0 ? void 0 : pageSizeOptions[0]) || DEFAULT_PAGE_SIZES[0], currentPageIndex = 0, rowDisabledPredicate = defaultIsRowDisabled, sortBy, sortingDirection = exports.defaultProps.sortingDirection, iconSortAsc, iconSortDesc, iconNoSort, sortingDidChange, willSort, style, className, noDataRenderer, autoFocus = exports.defaultProps.autoFocus, hideHeader = exports.defaultProps.hideHeader, hideNoDataView = exports.defaultProps.hideNoDataView, alwaysShowSelectionHeader = exports.defaultProps.alwaysShowSelectionHeader, registerComponentApi, onSelectionDidChange, noBottomBorder = exports.defaultProps.noBottomBorder, paginationControlsLocation = exports.defaultProps.paginationControlsLocation, cellVerticalAlign = exports.defaultProps.cellVerticalAlign, buttonRowPosition = exports.defaultProps.buttonRowPosition, pageSizeSelectorPosition = exports.defaultProps.pageSizeSelectorPosition, pageInfoPosition = exports.defaultProps.pageInfoPosition, showCurrentPage = exports.defaultProps.showCurrentPage, showPageInfo = exports.defaultProps.showPageInfo, showPageSizeSelector = exports.defaultProps.showPageSizeSelector } = _a, rest = __rest(_a, ["data", "columns", "isPaginated", "loading", "headerHeight", "rowsSelectable", "enableMultiRowSelection", "pageSizeOptions", "pageSize", "currentPageIndex", "rowDisabledPredicate", "sortBy", "sortingDirection", "iconSortAsc", "iconSortDesc", "iconNoSort", "sortingDidChange", "willSort", "style", "className", "noDataRenderer", "autoFocus", "hideHeader", "hideNoDataView", "alwaysShowSelectionHeader", "registerComponentApi", "onSelectionDidChange", "noBottomBorder", "paginationControlsLocation", "cellVerticalAlign", "buttonRowPosition", "pageSizeSelectorPosition", "pageInfoPosition", "showCurrentPage", "showPageInfo", "showPageSizeSelector"])
|
|
77
|
+
var { data = exports.defaultProps.data, columns = exports.defaultProps.columns, isPaginated = exports.defaultProps.isPaginated, loading = exports.defaultProps.loading, headerHeight, rowsSelectable = exports.defaultProps.rowsSelectable, enableMultiRowSelection = exports.defaultProps.enableMultiRowSelection, initiallySelected = exports.defaultProps.initiallySelected, syncWithAppState, pageSizeOptions = exports.defaultProps.pageSizeOptions, pageSize = (pageSizeOptions === null || pageSizeOptions === void 0 ? void 0 : pageSizeOptions[0]) || DEFAULT_PAGE_SIZES[0], currentPageIndex = 0, rowDisabledPredicate = defaultIsRowDisabled, sortBy, sortingDirection = exports.defaultProps.sortingDirection, iconSortAsc, iconSortDesc, iconNoSort, sortingDidChange, willSort, style, className, noDataRenderer, autoFocus = exports.defaultProps.autoFocus, hideHeader = exports.defaultProps.hideHeader, hideNoDataView = exports.defaultProps.hideNoDataView, alwaysShowSelectionHeader = exports.defaultProps.alwaysShowSelectionHeader, registerComponentApi, onSelectionDidChange, noBottomBorder = exports.defaultProps.noBottomBorder, paginationControlsLocation = exports.defaultProps.paginationControlsLocation, cellVerticalAlign = exports.defaultProps.cellVerticalAlign, buttonRowPosition = exports.defaultProps.buttonRowPosition, pageSizeSelectorPosition = exports.defaultProps.pageSizeSelectorPosition, pageInfoPosition = exports.defaultProps.pageInfoPosition, showCurrentPage = exports.defaultProps.showCurrentPage, showPageInfo = exports.defaultProps.showPageInfo, showPageSizeSelector = exports.defaultProps.showPageSizeSelector } = _a, rest = __rest(_a, ["data", "columns", "isPaginated", "loading", "headerHeight", "rowsSelectable", "enableMultiRowSelection", "initiallySelected", "syncWithAppState", "pageSizeOptions", "pageSize", "currentPageIndex", "rowDisabledPredicate", "sortBy", "sortingDirection", "iconSortAsc", "iconSortDesc", "iconNoSort", "sortingDidChange", "willSort", "style", "className", "noDataRenderer", "autoFocus", "hideHeader", "hideNoDataView", "alwaysShowSelectionHeader", "registerComponentApi", "onSelectionDidChange", "noBottomBorder", "paginationControlsLocation", "cellVerticalAlign", "buttonRowPosition", "pageSizeSelectorPosition", "pageInfoPosition", "showCurrentPage", "showPageInfo", "showPageSizeSelector"])
|
|
78
78
|
// cols
|
|
79
79
|
;
|
|
80
80
|
const { getThemeVar } = (0, ThemeContext_1.useTheme)();
|
|
@@ -107,6 +107,8 @@ exports.Table = (0, react_1.forwardRef)((_a, forwardedRef) => {
|
|
|
107
107
|
enableMultiRowSelection,
|
|
108
108
|
rowDisabledPredicate,
|
|
109
109
|
onSelectionDidChange,
|
|
110
|
+
initiallySelected,
|
|
111
|
+
syncWithAppState,
|
|
110
112
|
});
|
|
111
113
|
// --- Create data with order information whenever the items in the table change
|
|
112
114
|
const dataWithOrder = (0, react_1.useMemo)(() => {
|
|
@@ -492,6 +494,7 @@ exports.defaultProps = {
|
|
|
492
494
|
loading: false,
|
|
493
495
|
rowsSelectable: false,
|
|
494
496
|
enableMultiRowSelection: true,
|
|
497
|
+
initiallySelected: constants_1.EMPTY_ARRAY,
|
|
495
498
|
pageSizeOptions: [5, 10, 15],
|
|
496
499
|
sortingDirection: "ascending",
|
|
497
500
|
autoFocus: false,
|