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
|
@@ -0,0 +1,418 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const component_test_helpers_1 = require("../../testing/component-test-helpers");
|
|
13
|
+
const fixtures_1 = require("../../testing/fixtures");
|
|
14
|
+
// Use low delay duration for faster tests as suggested
|
|
15
|
+
const LOW_DELAY = 10;
|
|
16
|
+
// =============================================================================
|
|
17
|
+
// BASIC FUNCTIONALITY TESTS
|
|
18
|
+
// =============================================================================
|
|
19
|
+
fixtures_1.test.describe("Basic Functionality", () => {
|
|
20
|
+
(0, fixtures_1.test)("renders component", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
21
|
+
yield initTestBed(`
|
|
22
|
+
<Tooltip delayDuration="${LOW_DELAY}" text="I'm a tooltip!">
|
|
23
|
+
<Button label="Hover me!" testId="tooltip-button" />
|
|
24
|
+
</Tooltip>
|
|
25
|
+
`);
|
|
26
|
+
const button = page.getByTestId("tooltip-button");
|
|
27
|
+
yield (0, fixtures_1.expect)(button).toBeVisible();
|
|
28
|
+
// Hover over the button to trigger tooltip
|
|
29
|
+
yield button.hover();
|
|
30
|
+
// Wait for tooltip to appear with low delay
|
|
31
|
+
yield (0, fixtures_1.expect)(page.locator("[data-tooltip-container]")).toBeVisible();
|
|
32
|
+
}));
|
|
33
|
+
// Note: This test is mainly to verify that the tooltip has the correct role for accessibility but
|
|
34
|
+
// is placed here since we use getByRole for the content.
|
|
35
|
+
// Fetching by data attribute is for the dimension tests below.
|
|
36
|
+
(0, fixtures_1.test)("has correct 'role' attribute", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
37
|
+
yield initTestBed(`
|
|
38
|
+
<Tooltip text="Tooltip" defaultOpen="true" delayDuration="${LOW_DELAY}">
|
|
39
|
+
<Button label="Button with default open tooltip" />
|
|
40
|
+
</Tooltip>
|
|
41
|
+
`);
|
|
42
|
+
const tooltip = page.getByRole("tooltip");
|
|
43
|
+
yield (0, fixtures_1.expect)(tooltip).toBeVisible();
|
|
44
|
+
yield (0, fixtures_1.expect)(tooltip).toContainText("Tooltip");
|
|
45
|
+
}));
|
|
46
|
+
(0, fixtures_1.test)("renders with tooltip property", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
47
|
+
yield initTestBed(`
|
|
48
|
+
<Tooltip delayDuration="${LOW_DELAY}" text="I'm a tooltip!">
|
|
49
|
+
<Button label="Hover me!" testId="tooltip-button" />
|
|
50
|
+
</Tooltip>
|
|
51
|
+
`);
|
|
52
|
+
const button = page.getByTestId("tooltip-button");
|
|
53
|
+
yield (0, fixtures_1.expect)(button).toBeVisible();
|
|
54
|
+
// Hover over the button to trigger tooltip
|
|
55
|
+
yield button.hover();
|
|
56
|
+
// Wait for tooltip to appear with low delay
|
|
57
|
+
yield (0, fixtures_1.expect)(page.getByRole("tooltip")).toHaveText("I'm a tooltip!");
|
|
58
|
+
// Note: We skip testing tooltip hiding as it's dependent on implementation details
|
|
59
|
+
// and the main functionality test is that it appears correctly on hover
|
|
60
|
+
}));
|
|
61
|
+
(0, fixtures_1.test)("renders with markdown content", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
62
|
+
yield initTestBed(`
|
|
63
|
+
<Tooltip delayDuration="${LOW_DELAY}" markdown="This *example* uses \`tooltipMarkdown\`">
|
|
64
|
+
<Card title="Tooltip with markdown" testId="markdown-card" />
|
|
65
|
+
</Tooltip>
|
|
66
|
+
`);
|
|
67
|
+
const card = page.getByTestId("markdown-card");
|
|
68
|
+
yield (0, fixtures_1.expect)(card).toBeVisible();
|
|
69
|
+
// Hover to show tooltip
|
|
70
|
+
yield card.hover();
|
|
71
|
+
// Check that markdown is rendered (looking for emphasis and code elements)
|
|
72
|
+
const tooltip = page.getByRole("tooltip");
|
|
73
|
+
yield (0, fixtures_1.expect)(tooltip).toBeVisible();
|
|
74
|
+
yield (0, fixtures_1.expect)(tooltip.locator("em")).toContainText("example");
|
|
75
|
+
yield (0, fixtures_1.expect)(tooltip.locator("code")).toContainText("tooltipMarkdown");
|
|
76
|
+
}));
|
|
77
|
+
(0, fixtures_1.test)("renders with 'side' property set to right", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
78
|
+
yield initTestBed(`
|
|
79
|
+
<CVStack height="200px" horizontalAlignment="center" verticalAlignment="center">
|
|
80
|
+
<Tooltip delayDuration="${LOW_DELAY}" text="I'm positioned right" side="right">
|
|
81
|
+
<Button label="Hover me!" testId="right-tooltip-button" />
|
|
82
|
+
</Tooltip>
|
|
83
|
+
</CVStack>
|
|
84
|
+
`);
|
|
85
|
+
const button = page.getByTestId("right-tooltip-button");
|
|
86
|
+
yield button.hover();
|
|
87
|
+
const tooltip = page.getByText("I'm positioned right");
|
|
88
|
+
yield (0, fixtures_1.expect)(tooltip).toBeVisible();
|
|
89
|
+
// Verify tooltip is positioned to the right of the button
|
|
90
|
+
const buttonBox = yield (0, component_test_helpers_1.getBounds)(button);
|
|
91
|
+
const tooltipBox = yield (0, component_test_helpers_1.getBounds)(tooltip);
|
|
92
|
+
(0, fixtures_1.expect)(tooltipBox.left).toBeGreaterThan(buttonBox.right);
|
|
93
|
+
}));
|
|
94
|
+
(0, fixtures_1.test)("renders with 'side' property set to left", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
95
|
+
yield initTestBed(`
|
|
96
|
+
<CVStack height="200px" horizontalAlignment="center" verticalAlignment="center">
|
|
97
|
+
<Tooltip delayDuration="${LOW_DELAY}" text="I'm positioned left" side="left">
|
|
98
|
+
<Button label="Hover me!" testId="left-tooltip-button" />
|
|
99
|
+
</Tooltip>
|
|
100
|
+
</CVStack>
|
|
101
|
+
`);
|
|
102
|
+
const button = page.getByTestId("left-tooltip-button");
|
|
103
|
+
yield button.hover();
|
|
104
|
+
const tooltip = page.getByText("I'm positioned left");
|
|
105
|
+
yield (0, fixtures_1.expect)(tooltip).toBeVisible();
|
|
106
|
+
// Verify tooltip is positioned to the right of the button
|
|
107
|
+
const buttonBox = yield (0, component_test_helpers_1.getBounds)(button);
|
|
108
|
+
const tooltipBox = yield (0, component_test_helpers_1.getBounds)(tooltip);
|
|
109
|
+
(0, fixtures_1.expect)(tooltipBox.right).toBeLessThan(buttonBox.left);
|
|
110
|
+
}));
|
|
111
|
+
(0, fixtures_1.test)("renders with 'side' property set to top", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
112
|
+
yield initTestBed(`
|
|
113
|
+
<CVStack height="200px" horizontalAlignment="center" verticalAlignment="center">
|
|
114
|
+
<Tooltip delayDuration="${LOW_DELAY}" text="I'm positioned top" side="top">
|
|
115
|
+
<Button label="Hover me!" testId="top-tooltip-button" />
|
|
116
|
+
</Tooltip>
|
|
117
|
+
</CVStack>
|
|
118
|
+
`);
|
|
119
|
+
const button = page.getByTestId("top-tooltip-button");
|
|
120
|
+
yield button.hover();
|
|
121
|
+
const tooltip = page.getByText("I'm positioned top");
|
|
122
|
+
yield (0, fixtures_1.expect)(tooltip).toBeVisible();
|
|
123
|
+
// Verify tooltip is positioned above the button
|
|
124
|
+
const buttonBox = yield (0, component_test_helpers_1.getBounds)(button);
|
|
125
|
+
const tooltipBox = yield (0, component_test_helpers_1.getBounds)(tooltip);
|
|
126
|
+
(0, fixtures_1.expect)(tooltipBox.bottom).toBeLessThan(buttonBox.top);
|
|
127
|
+
}));
|
|
128
|
+
(0, fixtures_1.test)("renders with 'side' property set to bottom", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
129
|
+
yield initTestBed(`
|
|
130
|
+
<CVStack height="200px" horizontalAlignment="center" verticalAlignment="center">
|
|
131
|
+
<Tooltip delayDuration="${LOW_DELAY}" text="I'm positioned bottom" side="bottom">
|
|
132
|
+
<Button label="Hover me!" testId="bottom-tooltip-button" />
|
|
133
|
+
</Tooltip>
|
|
134
|
+
</CVStack>
|
|
135
|
+
`);
|
|
136
|
+
const button = page.getByTestId("bottom-tooltip-button");
|
|
137
|
+
yield button.hover();
|
|
138
|
+
const tooltip = page.getByText("I'm positioned bottom");
|
|
139
|
+
yield (0, fixtures_1.expect)(tooltip).toBeVisible();
|
|
140
|
+
// Verify tooltip is positioned below the button
|
|
141
|
+
const buttonBox = yield (0, component_test_helpers_1.getBounds)(button);
|
|
142
|
+
const tooltipBox = yield (0, component_test_helpers_1.getBounds)(tooltip);
|
|
143
|
+
(0, fixtures_1.expect)(tooltipBox.top).toBeGreaterThan(buttonBox.bottom);
|
|
144
|
+
}));
|
|
145
|
+
(0, fixtures_1.test)(`renders with 'sideOffset' property when side is top`, (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
146
|
+
yield initTestBed(`
|
|
147
|
+
<CVStack height="200px" horizontalAlignment="center" verticalAlignment="center">
|
|
148
|
+
<Tooltip side="top" text="Tooltip" sideOffset="28" delayDuration="${LOW_DELAY}">
|
|
149
|
+
<Icon name="email" testId="tooltip-icon" />
|
|
150
|
+
</Tooltip>
|
|
151
|
+
</CVStack>
|
|
152
|
+
`);
|
|
153
|
+
const icon = page.getByTestId("tooltip-icon");
|
|
154
|
+
yield icon.hover();
|
|
155
|
+
const tooltip = page.locator("[data-tooltip-container]");
|
|
156
|
+
// Verify tooltip is positioned above the icon with the correct offset
|
|
157
|
+
const iconBox = yield (0, component_test_helpers_1.getBounds)(icon);
|
|
158
|
+
const tooltipBox = yield (0, component_test_helpers_1.getBounds)(tooltip);
|
|
159
|
+
(0, fixtures_1.expect)(iconBox.top - tooltipBox.bottom).toEqualWithTolerance(28, 4);
|
|
160
|
+
}));
|
|
161
|
+
(0, fixtures_1.test)(`renders with 'sideOffset' property when side is bottom`, (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
162
|
+
yield initTestBed(`
|
|
163
|
+
<Stack height="200px" horizontalAlignment="center" verticalAlignment="center">
|
|
164
|
+
<Tooltip side="bottom" text="Tooltip" sideOffset="28" delayDuration="${LOW_DELAY}">
|
|
165
|
+
<Icon name="email" testId="tooltip-icon" />
|
|
166
|
+
</Tooltip>
|
|
167
|
+
</Stack>
|
|
168
|
+
`);
|
|
169
|
+
const icon = page.getByTestId("tooltip-icon");
|
|
170
|
+
yield icon.hover();
|
|
171
|
+
const tooltip = page.locator("[data-tooltip-container]");
|
|
172
|
+
// Verify tooltip is positioned below the icon with the correct offset
|
|
173
|
+
const iconBox = yield (0, component_test_helpers_1.getBounds)(icon);
|
|
174
|
+
const tooltipBox = yield (0, component_test_helpers_1.getBounds)(tooltip);
|
|
175
|
+
(0, fixtures_1.expect)(tooltipBox.top - iconBox.bottom).toBeGreaterThanOrEqual(28);
|
|
176
|
+
}));
|
|
177
|
+
(0, fixtures_1.test)(`renders with 'sideOffset' property when side is left`, (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
178
|
+
yield initTestBed(`
|
|
179
|
+
<Stack height="200px" horizontalAlignment="center" verticalAlignment="center">
|
|
180
|
+
<Tooltip side="left" text="Tooltip" sideOffset="28" delayDuration="${LOW_DELAY}">
|
|
181
|
+
<Icon name="email" testId="tooltip-icon-left" />
|
|
182
|
+
</Tooltip>
|
|
183
|
+
</Stack>
|
|
184
|
+
`);
|
|
185
|
+
const icon = page.getByTestId("tooltip-icon-left");
|
|
186
|
+
yield icon.hover();
|
|
187
|
+
const tooltip = page.getByRole("tooltip");
|
|
188
|
+
// Verify tooltip is positioned to the left of the icon with the correct offset
|
|
189
|
+
const iconBox = yield (0, component_test_helpers_1.getBounds)(icon);
|
|
190
|
+
const tooltipBox = yield (0, component_test_helpers_1.getBounds)(tooltip);
|
|
191
|
+
(0, fixtures_1.expect)(iconBox.left - tooltipBox.right).toBeGreaterThanOrEqual(28);
|
|
192
|
+
}));
|
|
193
|
+
(0, fixtures_1.test)(`renders with 'sideOffset' property when side is right`, (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
194
|
+
yield initTestBed(`
|
|
195
|
+
<Stack height="200px" horizontalAlignment="center" verticalAlignment="center">
|
|
196
|
+
<Tooltip side="right" text="Tooltip" sideOffset="28" delayDuration="${LOW_DELAY}">
|
|
197
|
+
<Icon name="email" testId="tooltip-icon-right" />
|
|
198
|
+
</Tooltip>
|
|
199
|
+
</Stack>
|
|
200
|
+
`);
|
|
201
|
+
const icon = page.getByTestId("tooltip-icon-right");
|
|
202
|
+
yield icon.hover();
|
|
203
|
+
const tooltip = page.getByRole("tooltip");
|
|
204
|
+
// Verify tooltip is positioned to the right of the icon with the correct offset
|
|
205
|
+
const iconBox = yield (0, component_test_helpers_1.getBounds)(icon);
|
|
206
|
+
const tooltipBox = yield (0, component_test_helpers_1.getBounds)(tooltip);
|
|
207
|
+
(0, fixtures_1.expect)(tooltipBox.left - iconBox.right).toBeGreaterThanOrEqual(28);
|
|
208
|
+
}));
|
|
209
|
+
(0, fixtures_1.test)("Tooltip is shown for all wrapped children", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
210
|
+
yield initTestBed(`
|
|
211
|
+
<Tooltip side="bottom" markdown="This *example* uses a \`Tooltip\` component" delayDuration="${LOW_DELAY}">
|
|
212
|
+
<VStack horizontalAlignment="center">
|
|
213
|
+
<Card title="Card 1: within a Tooltip" testId="tooltip-card-1" />
|
|
214
|
+
<Card title="Card 2: within the same Tooltip" testId="tooltip-card-2" />
|
|
215
|
+
</VStack>
|
|
216
|
+
</Tooltip>
|
|
217
|
+
`);
|
|
218
|
+
const card1 = page.getByTestId("tooltip-card-1");
|
|
219
|
+
const card2 = page.getByTestId("tooltip-card-2");
|
|
220
|
+
yield (0, fixtures_1.expect)(card1).toBeVisible();
|
|
221
|
+
yield (0, fixtures_1.expect)(card2).toBeVisible();
|
|
222
|
+
// Hover over first card
|
|
223
|
+
yield card1.hover();
|
|
224
|
+
const tooltip = page.getByRole("tooltip");
|
|
225
|
+
yield (0, fixtures_1.expect)(tooltip.locator("em")).toContainText("example");
|
|
226
|
+
yield (0, fixtures_1.expect)(tooltip.locator("code")).toContainText("Tooltip");
|
|
227
|
+
// Move to second card - tooltip should still be visible
|
|
228
|
+
yield card2.hover();
|
|
229
|
+
yield (0, fixtures_1.expect)(tooltip).toBeVisible();
|
|
230
|
+
}));
|
|
231
|
+
(0, fixtures_1.test)("renders with 'tooltipTemplate' property", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
232
|
+
yield initTestBed(`
|
|
233
|
+
<VStack height="100px" horizontalAlignment="center">
|
|
234
|
+
<Tooltip side="bottom" delayDuration="${LOW_DELAY}">
|
|
235
|
+
<property name="tooltipTemplate">
|
|
236
|
+
<HStack>
|
|
237
|
+
<Stack width="24px" height="24px" backgroundColor="purple" testId="purple-square" />
|
|
238
|
+
<H2>This is a tooltip</H2>
|
|
239
|
+
</HStack>
|
|
240
|
+
</property>
|
|
241
|
+
<Card title="I have a templated Tooltip!" testId="template-card" />
|
|
242
|
+
</Tooltip>
|
|
243
|
+
</VStack>
|
|
244
|
+
`);
|
|
245
|
+
const card = page.getByTestId("template-card");
|
|
246
|
+
yield card.hover();
|
|
247
|
+
// Check that custom template elements are present
|
|
248
|
+
const tooltip = page.locator('[role="tooltip"]');
|
|
249
|
+
yield (0, fixtures_1.expect)(tooltip).toBeVisible();
|
|
250
|
+
yield (0, fixtures_1.expect)(tooltip.getByTestId("purple-square")).toBeVisible();
|
|
251
|
+
yield (0, fixtures_1.expect)(tooltip.getByRole("heading", { level: 2 })).toContainText("This is a tooltip");
|
|
252
|
+
}));
|
|
253
|
+
(0, fixtures_1.test)("renders with start 'align' property value", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
254
|
+
yield initTestBed(`
|
|
255
|
+
<HStack horizontalAlignment="center">
|
|
256
|
+
<Tooltip delayDuration="${LOW_DELAY}" text="Start aligned" side="bottom" align="start">
|
|
257
|
+
<Button label="Start aligned Start aligned" testId="start-button" />
|
|
258
|
+
</Tooltip>
|
|
259
|
+
</HStack>
|
|
260
|
+
`);
|
|
261
|
+
const startButton = page.getByTestId("start-button");
|
|
262
|
+
yield startButton.hover();
|
|
263
|
+
const tooltipBox = yield (0, component_test_helpers_1.getBounds)(page.locator("div[data-tooltip-container]"));
|
|
264
|
+
const buttonBox = yield (0, component_test_helpers_1.getBounds)(startButton);
|
|
265
|
+
(0, fixtures_1.expect)(tooltipBox.left + tooltipBox.width / 2).toBeLessThan(buttonBox.left + buttonBox.width / 2);
|
|
266
|
+
}));
|
|
267
|
+
(0, fixtures_1.test)("renders with center 'align' property value", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
268
|
+
yield initTestBed(`
|
|
269
|
+
<HStack horizontalAlignment="center">
|
|
270
|
+
<Tooltip delayDuration="${LOW_DELAY}" text="Center aligned" side="bottom" align="center">
|
|
271
|
+
<Button label="Center aligned Center aligned" testId="center-button" />
|
|
272
|
+
</Tooltip>
|
|
273
|
+
</HStack>
|
|
274
|
+
`);
|
|
275
|
+
const centerButton = page.getByTestId("center-button");
|
|
276
|
+
yield centerButton.hover();
|
|
277
|
+
const tooltipBox = yield (0, component_test_helpers_1.getBounds)(page.locator("div[data-tooltip-container]"));
|
|
278
|
+
const buttonBox = yield (0, component_test_helpers_1.getBounds)(centerButton);
|
|
279
|
+
(0, fixtures_1.expect)(tooltipBox.left + tooltipBox.width / 2).toEqualWithTolerance(buttonBox.left + buttonBox.width / 2, 10);
|
|
280
|
+
}));
|
|
281
|
+
(0, fixtures_1.test)("renders with end 'align' property value", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
282
|
+
yield initTestBed(`
|
|
283
|
+
<HStack horizontalAlignment="center">
|
|
284
|
+
<Tooltip delayDuration="${LOW_DELAY}" text="End aligned" side="bottom" align="end">
|
|
285
|
+
<Button label="End aligned End aligned" testId="end-button" />
|
|
286
|
+
</Tooltip>
|
|
287
|
+
</HStack>
|
|
288
|
+
`);
|
|
289
|
+
const endButton = page.getByTestId("end-button");
|
|
290
|
+
yield endButton.hover();
|
|
291
|
+
const tooltipBox = yield (0, component_test_helpers_1.getBounds)(page.locator("div[data-tooltip-container]"));
|
|
292
|
+
const buttonBox = yield (0, component_test_helpers_1.getBounds)(endButton);
|
|
293
|
+
(0, fixtures_1.expect)(tooltipBox.left + tooltipBox.width / 2).toBeGreaterThan(buttonBox.left + buttonBox.width / 2);
|
|
294
|
+
}));
|
|
295
|
+
(0, fixtures_1.test)("renders with 'defaultOpen' property", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
296
|
+
yield initTestBed(`
|
|
297
|
+
<Tooltip text="Always visible tooltip" defaultOpen="true" delayDuration="${LOW_DELAY}">
|
|
298
|
+
<Button label="Button with default open tooltip" testId="default-open-button" />
|
|
299
|
+
</Tooltip>
|
|
300
|
+
`);
|
|
301
|
+
yield (0, fixtures_1.expect)(page.locator("div[data-tooltip-container]")).toBeVisible();
|
|
302
|
+
yield (0, fixtures_1.expect)(page.getByTestId("default-open-button")).toBeVisible();
|
|
303
|
+
}));
|
|
304
|
+
});
|
|
305
|
+
// =============================================================================
|
|
306
|
+
// ACCESSIBILITY TESTS
|
|
307
|
+
// =============================================================================
|
|
308
|
+
fixtures_1.test.describe("Accessibility", () => {
|
|
309
|
+
(0, fixtures_1.test)("tooltip content is accessible via screen reader", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
310
|
+
yield initTestBed(`
|
|
311
|
+
<Tooltip text="This tooltip is accessible" defaultOpen="true" delayDuration="${LOW_DELAY}">
|
|
312
|
+
<Button label="Button with default open tooltip" />
|
|
313
|
+
</Tooltip>
|
|
314
|
+
`);
|
|
315
|
+
// Check that tooltip has proper accessibility attributes
|
|
316
|
+
const tooltip = page.getByRole("tooltip");
|
|
317
|
+
yield (0, fixtures_1.expect)(tooltip).toBeVisible();
|
|
318
|
+
// Verify tooltip content is properly exposed
|
|
319
|
+
yield (0, fixtures_1.expect)(tooltip).toHaveText("This tooltip is accessible");
|
|
320
|
+
}));
|
|
321
|
+
});
|
|
322
|
+
// =============================================================================
|
|
323
|
+
// THEME VARIABLE TESTS
|
|
324
|
+
// =============================================================================
|
|
325
|
+
fixtures_1.test.describe("Theme Variables", () => {
|
|
326
|
+
(0, fixtures_1.test)("applies 'backgroundColor-Tooltip' theme variable", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
327
|
+
yield initTestBed(`
|
|
328
|
+
<Tooltip text="This tooltip is accessible" defaultOpen="true" delayDuration="${LOW_DELAY}">
|
|
329
|
+
<Button label="Button with default open tooltip" />
|
|
330
|
+
</Tooltip>
|
|
331
|
+
`, {
|
|
332
|
+
testThemeVars: { "backgroundColor-Tooltip": "rgb(255, 0, 0)" },
|
|
333
|
+
});
|
|
334
|
+
yield (0, fixtures_1.expect)(page.locator("div[data-tooltip-container]")).toHaveCSS("background-color", "rgb(255, 0, 0)");
|
|
335
|
+
}));
|
|
336
|
+
(0, fixtures_1.test)("applies 'textColor-Tooltip' theme variable", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
337
|
+
yield initTestBed(`
|
|
338
|
+
<Tooltip text="This tooltip is accessible" defaultOpen="true" delayDuration="${LOW_DELAY}">
|
|
339
|
+
<Button label="Button with default open tooltip" />
|
|
340
|
+
</Tooltip>
|
|
341
|
+
`, {
|
|
342
|
+
testThemeVars: { "textColor-Tooltip": "rgb(0, 255, 0)" },
|
|
343
|
+
});
|
|
344
|
+
yield (0, fixtures_1.expect)(page.locator("div[data-tooltip-container]")).toHaveCSS("color", "rgb(0, 255, 0)");
|
|
345
|
+
}));
|
|
346
|
+
(0, fixtures_1.test)("applies 'borderRadius-Tooltip' theme variable", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
347
|
+
yield initTestBed(`
|
|
348
|
+
<Tooltip text="This tooltip is accessible" defaultOpen="true" delayDuration="${LOW_DELAY}">
|
|
349
|
+
<Button label="Button with default open tooltip" />
|
|
350
|
+
</Tooltip>
|
|
351
|
+
`, {
|
|
352
|
+
testThemeVars: { "borderRadius-Tooltip": "12px" },
|
|
353
|
+
});
|
|
354
|
+
yield (0, fixtures_1.expect)(page.locator("div[data-tooltip-container]")).toHaveCSS("border-radius", "12px");
|
|
355
|
+
}));
|
|
356
|
+
(0, fixtures_1.test)("applies 'fontSize-Tooltip' theme variable", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
357
|
+
yield initTestBed(`
|
|
358
|
+
<Tooltip text="This tooltip is accessible" defaultOpen="true" delayDuration="${LOW_DELAY}">
|
|
359
|
+
<Button label="Button with default open tooltip" />
|
|
360
|
+
</Tooltip>
|
|
361
|
+
`, {
|
|
362
|
+
testThemeVars: { "fontSize-Tooltip": "20px" },
|
|
363
|
+
});
|
|
364
|
+
const tooltip = page.getByRole("tooltip");
|
|
365
|
+
yield (0, fixtures_1.expect)(tooltip).toBeVisible();
|
|
366
|
+
yield (0, fixtures_1.expect)(tooltip).toHaveCSS("font-size", "20px");
|
|
367
|
+
}));
|
|
368
|
+
(0, fixtures_1.test)("applies 'paddingLeft-Tooltip' and 'paddingRight-Tooltip' theme variables", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed, }) {
|
|
369
|
+
yield initTestBed(`
|
|
370
|
+
<Tooltip text="This tooltip is accessible" defaultOpen="true" delayDuration="${LOW_DELAY}">
|
|
371
|
+
<Button label="Button with default open tooltip" />
|
|
372
|
+
</Tooltip>
|
|
373
|
+
`, {
|
|
374
|
+
testThemeVars: {
|
|
375
|
+
"paddingLeft-Tooltip": "20px",
|
|
376
|
+
"paddingRight-Tooltip": "25px",
|
|
377
|
+
},
|
|
378
|
+
});
|
|
379
|
+
yield (0, fixtures_1.expect)(page.locator("div[data-tooltip-container]")).toHaveCSS("padding-left", "20px");
|
|
380
|
+
yield (0, fixtures_1.expect)(page.locator("div[data-tooltip-container]")).toHaveCSS("padding-right", "25px");
|
|
381
|
+
}));
|
|
382
|
+
});
|
|
383
|
+
// =============================================================================
|
|
384
|
+
// OTHER EDGE CASE TESTS
|
|
385
|
+
// =============================================================================
|
|
386
|
+
fixtures_1.test.describe("Other Edge Cases", () => {
|
|
387
|
+
(0, fixtures_1.test)("handles empty tooltip text", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
388
|
+
yield initTestBed(`
|
|
389
|
+
<Tooltip text="" defaultOpen="true" delayDuration="${LOW_DELAY}">
|
|
390
|
+
<Button label="Button with empty tooltip" />
|
|
391
|
+
</Tooltip>
|
|
392
|
+
`);
|
|
393
|
+
// There should be no visible tooltip with meaningful content
|
|
394
|
+
const tooltips = page.getByRole("tooltip");
|
|
395
|
+
const count = yield tooltips.count();
|
|
396
|
+
if (count > 0) {
|
|
397
|
+
// If tooltip exists, it should be empty or not visible
|
|
398
|
+
const tooltip = tooltips.first();
|
|
399
|
+
const text = yield tooltip.textContent();
|
|
400
|
+
(0, fixtures_1.expect)(text === null || text === void 0 ? void 0 : text.trim()).toBe("");
|
|
401
|
+
}
|
|
402
|
+
}));
|
|
403
|
+
(0, fixtures_1.test)("handles tooltip without any content properties", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
404
|
+
yield initTestBed(`
|
|
405
|
+
<Tooltip>
|
|
406
|
+
<Button label="Button in tooltip without content" testId="no-content-button" />
|
|
407
|
+
</Tooltip>
|
|
408
|
+
`);
|
|
409
|
+
const button = page.getByTestId("no-content-button");
|
|
410
|
+
yield (0, fixtures_1.expect)(button).toBeVisible();
|
|
411
|
+
// Hover should not show tooltip since there's no content
|
|
412
|
+
yield button.hover();
|
|
413
|
+
// Should not find any tooltip with content
|
|
414
|
+
const tooltips = page.getByRole("tooltip");
|
|
415
|
+
const count = yield tooltips.count();
|
|
416
|
+
(0, fixtures_1.expect)(count).toBe(0);
|
|
417
|
+
}));
|
|
418
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const colorSchemes = {
|
|
4
|
+
"set3": "set3",
|
|
5
|
+
"tableau10": "tableau10",
|
|
6
|
+
"brown_blueGreen": "brown_blueGreen",
|
|
7
|
+
"purpleRed_green": "purpleRed_green",
|
|
8
|
+
"pink_yellowGreen": "pink_yellowGreen",
|
|
9
|
+
"purple_orange": "purple_orange",
|
|
10
|
+
"red_blue": "red_blue",
|
|
11
|
+
"red_grey": "red_grey",
|
|
12
|
+
"red_yellow_blue": "red_yellow_blue",
|
|
13
|
+
"red_yellow_green": "red_yellow_green",
|
|
14
|
+
"spectral": "spectral",
|
|
15
|
+
"blues": "blues",
|
|
16
|
+
"greens": "greens",
|
|
17
|
+
"greys": "greys",
|
|
18
|
+
"oranges": "oranges",
|
|
19
|
+
"purples": "purples",
|
|
20
|
+
"reds": "reds",
|
|
21
|
+
"blue_green": "blue_green",
|
|
22
|
+
"blue_purple": "blue_purple",
|
|
23
|
+
"green_blue": "green_blue",
|
|
24
|
+
"orange_red": "orange_red",
|
|
25
|
+
"purple_blue_green": "purple_blue_green",
|
|
26
|
+
"purple_blue": "purple_blue",
|
|
27
|
+
"purple_red": "purple_red",
|
|
28
|
+
"red_purple": "red_purple",
|
|
29
|
+
"yellow_green_blue": "yellow_green_blue",
|
|
30
|
+
"yellow_green": "yellow_green",
|
|
31
|
+
"yellow_orange_brown": "yellow_orange_brown",
|
|
32
|
+
"yellow_orange_red": "yellow_orange_red",
|
|
33
|
+
"nivo": "nivo",
|
|
34
|
+
"category10": "category10",
|
|
35
|
+
"accent": "accent",
|
|
36
|
+
"dark2": "dark2",
|
|
37
|
+
"paired": "paired",
|
|
38
|
+
"pastel1": "pastel1",
|
|
39
|
+
"pastel2": "pastel2",
|
|
40
|
+
"set1": "set1",
|
|
41
|
+
"set2": "set2"
|
|
42
|
+
};
|
|
43
|
+
exports.default = colorSchemes;
|
|
@@ -42,19 +42,30 @@ function ApiBoundComponent({ uid, node, apiBoundProps, apiBoundEvents, renderChi
|
|
|
42
42
|
function generateloaderUid(key) {
|
|
43
43
|
return `${node.uid}_data_${key}`;
|
|
44
44
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const
|
|
45
|
+
// Generates a string representation of an event handler function that calls
|
|
46
|
+
// the appropriate action. This function is used recursively for nested actions.
|
|
47
|
+
function generateEventHandler(actionComponent) {
|
|
48
|
+
const { type } = actionComponent;
|
|
49
|
+
// Prepares an event handler, which can be several types of data
|
|
50
|
+
// (string for inline JS functions, parsed objects, or nested action components)
|
|
51
|
+
const prepareEvent = (eventData) => {
|
|
52
|
+
if (!eventData) {
|
|
53
|
+
return "undefined";
|
|
54
|
+
}
|
|
55
|
+
if (typeof eventData === "string") {
|
|
56
|
+
return `"${eventData}"`;
|
|
57
|
+
}
|
|
58
|
+
if (typeof eventData.type === "string") {
|
|
59
|
+
return generateEventHandler(eventData);
|
|
60
|
+
}
|
|
61
|
+
return JSON.stringify(eventData);
|
|
62
|
+
};
|
|
63
|
+
// --- Prepare event handlers
|
|
64
|
+
const { success, error, progress, beforeRequest } = actionComponent.events || {};
|
|
52
65
|
switch (type) {
|
|
53
66
|
case "FileUpload": {
|
|
54
|
-
const actionComponent = node.events[key];
|
|
55
67
|
const { invalidates, asForm, formParams, queryParams, rawBody, body, url, headers, method, file, } = actionComponent.props;
|
|
56
|
-
|
|
57
|
-
events[key] = `(eventArgs) => {
|
|
68
|
+
return `(eventArgs) => {
|
|
58
69
|
return Actions.upload({
|
|
59
70
|
asForm: ${JSON.stringify(asForm)},
|
|
60
71
|
formParams: ${JSON.stringify(formParams)},
|
|
@@ -66,17 +77,15 @@ function ApiBoundComponent({ uid, node, apiBoundProps, apiBoundEvents, renderChi
|
|
|
66
77
|
method: ${JSON.stringify(method)},
|
|
67
78
|
file: ${JSON.stringify(file)},
|
|
68
79
|
params: { '$param': eventArgs },
|
|
69
|
-
onError: ${
|
|
70
|
-
onSuccess: ${
|
|
80
|
+
onError: ${prepareEvent(error)},
|
|
81
|
+
onSuccess: ${prepareEvent(success)},
|
|
71
82
|
onProgress: eventArgs.onProgress,
|
|
72
83
|
invalidates: ${invalidates === undefined ? undefined : JSON.stringify(invalidates)} }, { resolveBindingExpressions: true });
|
|
73
84
|
}`;
|
|
74
|
-
break;
|
|
75
85
|
}
|
|
76
86
|
case "FileDownload": {
|
|
77
|
-
const actionComponent = node.events[key];
|
|
78
87
|
const { url, queryParams, rawBody, body, headers, method, fileName } = actionComponent.props;
|
|
79
|
-
|
|
88
|
+
return `(eventArgs) => {
|
|
80
89
|
return Actions.download({
|
|
81
90
|
queryParams: ${JSON.stringify(queryParams)},
|
|
82
91
|
rawBody: ${JSON.stringify(rawBody)},
|
|
@@ -88,14 +97,11 @@ function ApiBoundComponent({ uid, node, apiBoundProps, apiBoundEvents, renderChi
|
|
|
88
97
|
params: { '$param': eventArgs },
|
|
89
98
|
}, { resolveBindingExpressions: true });
|
|
90
99
|
}`;
|
|
91
|
-
break;
|
|
92
100
|
}
|
|
93
101
|
case "APICall": {
|
|
94
|
-
const actionComponent = node.events[key];
|
|
95
102
|
const { when, uid } = actionComponent;
|
|
96
103
|
const { confirmTitle, confirmMessage, confirmButtonLabel, inProgressNotificationMessage, completedNotificationMessage, errorNotificationMessage, invalidates, updates, optimisticValue, getOptimisticValue, headers, payloadType, method, url, queryParams, rawBody, body, } = actionComponent.props;
|
|
97
|
-
|
|
98
|
-
events[key] = `(eventArgs, options) => {
|
|
104
|
+
return `(eventArgs, options) => {
|
|
99
105
|
return Actions.callApi({
|
|
100
106
|
uid: ${JSON.stringify(uid)},
|
|
101
107
|
headers: ${JSON.stringify(headers)},
|
|
@@ -111,10 +117,10 @@ function ApiBoundComponent({ uid, node, apiBoundProps, apiBoundEvents, renderChi
|
|
|
111
117
|
completedNotificationMessage: ${JSON.stringify(completedNotificationMessage)},
|
|
112
118
|
errorNotificationMessage: ${JSON.stringify(errorNotificationMessage)},
|
|
113
119
|
params: { '$param': eventArgs },
|
|
114
|
-
onError: ${
|
|
115
|
-
onProgress: ${
|
|
116
|
-
onBeforeRequest: ${
|
|
117
|
-
onSuccess: ${
|
|
120
|
+
onError: ${prepareEvent(error)},
|
|
121
|
+
onProgress: ${prepareEvent(progress)},
|
|
122
|
+
onBeforeRequest: ${prepareEvent(beforeRequest)},
|
|
123
|
+
onSuccess: ${prepareEvent(success)},
|
|
118
124
|
updates: ${JSON.stringify(updates)},
|
|
119
125
|
optimisticValue: ${JSON.stringify(optimisticValue)},
|
|
120
126
|
payloadType: ${JSON.stringify(payloadType)},
|
|
@@ -122,12 +128,20 @@ function ApiBoundComponent({ uid, node, apiBoundProps, apiBoundEvents, renderChi
|
|
|
122
128
|
invalidates: ${invalidates === undefined ? undefined : JSON.stringify(invalidates)},
|
|
123
129
|
when: ${when === undefined ? undefined : JSON.stringify(when)} }, { resolveBindingExpressions: true });
|
|
124
130
|
}`;
|
|
125
|
-
break;
|
|
126
131
|
}
|
|
127
132
|
default: {
|
|
128
133
|
throw new Error("Unknown event handler component type: ", type);
|
|
129
134
|
}
|
|
130
135
|
}
|
|
136
|
+
}
|
|
137
|
+
const loaders = [...(node.loaders || [])];
|
|
138
|
+
const events = Object.assign({}, (node.events || {}));
|
|
139
|
+
const props = Object.assign({}, (node.props || {}));
|
|
140
|
+
const vars = Object.assign({}, (node.vars || {}));
|
|
141
|
+
const api = Object.assign({}, (node.api || {}));
|
|
142
|
+
apiBoundEvents.forEach((key) => {
|
|
143
|
+
const actionComponent = node.events[key];
|
|
144
|
+
events[key] = generateEventHandler(actionComponent);
|
|
131
145
|
});
|
|
132
146
|
apiBoundProps.forEach((key) => {
|
|
133
147
|
var _a, _b, _c;
|