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,450 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const fixtures_1 = require("../../../testing/fixtures");
|
|
13
|
+
// Test data helpers - using proper XMLUI data format
|
|
14
|
+
const sampleData = `[
|
|
15
|
+
{ name: 'Jan', sales: 100, profit: 20 },
|
|
16
|
+
{ name: 'Feb', sales: 150, profit: 30 },
|
|
17
|
+
{ name: 'Mar', sales: 120, profit: 25 },
|
|
18
|
+
{ name: 'Apr', sales: 180, profit: 40 }
|
|
19
|
+
]`;
|
|
20
|
+
const emptyData = `[]`;
|
|
21
|
+
const singlePointData = `[
|
|
22
|
+
{ name: 'Jan', sales: 100, profit: 20 }
|
|
23
|
+
]`;
|
|
24
|
+
// Chart selectors - updated for actual Recharts output
|
|
25
|
+
const chartRoot = ".recharts-responsive-container";
|
|
26
|
+
const chartSvg = ".recharts-surface";
|
|
27
|
+
const linesSelector = ".recharts-line";
|
|
28
|
+
const legendSelector = ".recharts-legend-wrapper";
|
|
29
|
+
const tooltipSelector = ".recharts-tooltip-wrapper";
|
|
30
|
+
const xAxisSelector = ".recharts-xAxis";
|
|
31
|
+
const yAxisSelector = ".recharts-yAxis";
|
|
32
|
+
const xTicksSelector = ".recharts-xAxis .recharts-cartesian-axis-tick-value";
|
|
33
|
+
const yTicksSelector = ".recharts-yAxis .recharts-cartesian-axis-tick-value";
|
|
34
|
+
// --- Smoke Tests
|
|
35
|
+
fixtures_1.test.describe("smoke tests", { tag: "@smoke" }, () => {
|
|
36
|
+
(0, fixtures_1.test)("component renders with basic props", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
37
|
+
yield initTestBed(`
|
|
38
|
+
<LineChart
|
|
39
|
+
xKey="name"
|
|
40
|
+
data="{${sampleData}}"
|
|
41
|
+
yKeys="{['sales', 'profit']}"
|
|
42
|
+
width="600px"
|
|
43
|
+
height="400px"
|
|
44
|
+
/>
|
|
45
|
+
`);
|
|
46
|
+
yield page.waitForSelector(chartRoot, { timeout: 10000 });
|
|
47
|
+
yield (0, fixtures_1.expect)(page.locator(chartRoot)).toBeVisible();
|
|
48
|
+
}));
|
|
49
|
+
(0, fixtures_1.test)("renders correct number of line series", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
50
|
+
yield initTestBed(`
|
|
51
|
+
<LineChart
|
|
52
|
+
xKey="name"
|
|
53
|
+
data="{${sampleData}}"
|
|
54
|
+
yKeys="{['sales', 'profit']}"
|
|
55
|
+
width="600px"
|
|
56
|
+
height="400px"
|
|
57
|
+
/>
|
|
58
|
+
`);
|
|
59
|
+
yield page.waitForSelector(chartRoot, { timeout: 10000 });
|
|
60
|
+
yield (0, fixtures_1.expect)(page.locator(linesSelector)).toHaveCount(2);
|
|
61
|
+
}));
|
|
62
|
+
});
|
|
63
|
+
// --- Data Handling Tests
|
|
64
|
+
fixtures_1.test.describe("data handling", () => {
|
|
65
|
+
(0, fixtures_1.test)("renders with empty data array", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
66
|
+
yield initTestBed(`
|
|
67
|
+
<LineChart
|
|
68
|
+
xKey="name"
|
|
69
|
+
data="{${emptyData}}"
|
|
70
|
+
yKeys="{['sales', 'profit']}"
|
|
71
|
+
width="600px"
|
|
72
|
+
height="400px"
|
|
73
|
+
/>
|
|
74
|
+
`);
|
|
75
|
+
yield page.waitForSelector(chartRoot, { timeout: 10000 });
|
|
76
|
+
yield (0, fixtures_1.expect)(page.locator(linesSelector)).toHaveCount(0);
|
|
77
|
+
}));
|
|
78
|
+
(0, fixtures_1.test)("renders with single data point", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
79
|
+
yield initTestBed(`
|
|
80
|
+
<LineChart
|
|
81
|
+
xKey="name"
|
|
82
|
+
data="{${singlePointData}}"
|
|
83
|
+
yKeys="{['sales', 'profit']}"
|
|
84
|
+
width="600px"
|
|
85
|
+
height="400px"
|
|
86
|
+
/>
|
|
87
|
+
`);
|
|
88
|
+
yield page.waitForSelector(chartRoot, { timeout: 10000 });
|
|
89
|
+
yield (0, fixtures_1.expect)(page.locator(linesSelector)).toHaveCount(2);
|
|
90
|
+
}));
|
|
91
|
+
(0, fixtures_1.test)("handles non-array data gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
92
|
+
yield initTestBed(`
|
|
93
|
+
<LineChart
|
|
94
|
+
xKey="name"
|
|
95
|
+
data="{null}"
|
|
96
|
+
yKeys="{['sales', 'profit']}"
|
|
97
|
+
width="600px"
|
|
98
|
+
height="400px"
|
|
99
|
+
/>
|
|
100
|
+
`);
|
|
101
|
+
yield page.waitForSelector(chartRoot, { timeout: 10000 });
|
|
102
|
+
yield (0, fixtures_1.expect)(page.locator(linesSelector)).toHaveCount(0);
|
|
103
|
+
}));
|
|
104
|
+
});
|
|
105
|
+
// --- Legend Tests
|
|
106
|
+
fixtures_1.test.describe("legend", () => {
|
|
107
|
+
(0, fixtures_1.test)("legend is hidden by default", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
108
|
+
yield initTestBed(`
|
|
109
|
+
<LineChart
|
|
110
|
+
xKey="name"
|
|
111
|
+
data="{${sampleData}}"
|
|
112
|
+
yKeys="{['sales', 'profit']}"
|
|
113
|
+
width="600px"
|
|
114
|
+
height="400px"
|
|
115
|
+
/>
|
|
116
|
+
`);
|
|
117
|
+
yield page.waitForSelector(chartRoot, { timeout: 10000 });
|
|
118
|
+
yield (0, fixtures_1.expect)(page.locator(legendSelector)).not.toBeVisible();
|
|
119
|
+
}));
|
|
120
|
+
(0, fixtures_1.test)("legend is shown when showLegend is true", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
121
|
+
yield initTestBed(`
|
|
122
|
+
<LineChart
|
|
123
|
+
xKey="name"
|
|
124
|
+
data="{${sampleData}}"
|
|
125
|
+
yKeys="{['sales', 'profit']}"
|
|
126
|
+
showLegend
|
|
127
|
+
width="600px"
|
|
128
|
+
height="400px"
|
|
129
|
+
/>
|
|
130
|
+
`);
|
|
131
|
+
yield page.waitForSelector(chartRoot, { timeout: 10000 });
|
|
132
|
+
yield (0, fixtures_1.expect)(page.locator(legendSelector)).toBeVisible();
|
|
133
|
+
}));
|
|
134
|
+
});
|
|
135
|
+
// --- Tooltip Tests
|
|
136
|
+
fixtures_1.test.describe("tooltip", () => {
|
|
137
|
+
(0, fixtures_1.test)("tooltip appears on hover by default", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
138
|
+
yield initTestBed(`
|
|
139
|
+
<LineChart
|
|
140
|
+
xKey="name"
|
|
141
|
+
data="{${sampleData}}"
|
|
142
|
+
yKeys="{['sales', 'profit']}"
|
|
143
|
+
width="600px"
|
|
144
|
+
height="400px"
|
|
145
|
+
/>
|
|
146
|
+
`);
|
|
147
|
+
yield page.waitForSelector(chartRoot, { timeout: 10000 });
|
|
148
|
+
const chart = page.locator(chartSvg).first();
|
|
149
|
+
yield chart.hover({ position: { x: 200, y: 100 } });
|
|
150
|
+
// Wait for tooltip to appear
|
|
151
|
+
yield page.waitForTimeout(500);
|
|
152
|
+
yield (0, fixtures_1.expect)(page.locator(tooltipSelector)).toBeVisible();
|
|
153
|
+
}));
|
|
154
|
+
(0, fixtures_1.test)("tooltip is hidden when hideTooltip is true", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
155
|
+
yield initTestBed(`
|
|
156
|
+
<LineChart
|
|
157
|
+
xKey="name"
|
|
158
|
+
data="{${sampleData}}"
|
|
159
|
+
yKeys="{['sales', 'profit']}"
|
|
160
|
+
hideTooltip
|
|
161
|
+
width="600px"
|
|
162
|
+
height="400px"
|
|
163
|
+
/>
|
|
164
|
+
`);
|
|
165
|
+
yield page.waitForSelector(chartRoot, { timeout: 10000 });
|
|
166
|
+
const chart = page.locator(chartSvg).first();
|
|
167
|
+
yield chart.hover({ position: { x: 200, y: 100 } });
|
|
168
|
+
yield page.waitForTimeout(500);
|
|
169
|
+
yield (0, fixtures_1.expect)(page.locator(tooltipSelector)).not.toBeVisible();
|
|
170
|
+
}));
|
|
171
|
+
});
|
|
172
|
+
// --- Axis Tests
|
|
173
|
+
fixtures_1.test.describe("x-axis", () => {
|
|
174
|
+
(0, fixtures_1.test)("x-axis is shown by default", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
175
|
+
yield initTestBed(`
|
|
176
|
+
<LineChart
|
|
177
|
+
xKey="name"
|
|
178
|
+
data="{${sampleData}}"
|
|
179
|
+
yKeys="{['sales', 'profit']}"
|
|
180
|
+
width="600px"
|
|
181
|
+
height="400px"
|
|
182
|
+
/>
|
|
183
|
+
`);
|
|
184
|
+
yield page.waitForSelector(chartRoot, { timeout: 10000 });
|
|
185
|
+
yield (0, fixtures_1.expect)(page.locator(xAxisSelector)).toBeVisible();
|
|
186
|
+
// Check that at least one tick is present
|
|
187
|
+
const tickCount = yield page.locator(xTicksSelector).count();
|
|
188
|
+
(0, fixtures_1.expect)(tickCount).toBeGreaterThan(0);
|
|
189
|
+
}));
|
|
190
|
+
(0, fixtures_1.test)("x-axis is hidden when hideX is true", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
191
|
+
yield initTestBed(`
|
|
192
|
+
<LineChart
|
|
193
|
+
xKey="name"
|
|
194
|
+
data="{${sampleData}}"
|
|
195
|
+
yKeys="{['sales', 'profit']}"
|
|
196
|
+
hideX
|
|
197
|
+
width="600px"
|
|
198
|
+
height="400px"
|
|
199
|
+
/>
|
|
200
|
+
`);
|
|
201
|
+
yield page.waitForSelector(chartRoot, { timeout: 10000 });
|
|
202
|
+
yield (0, fixtures_1.expect)(page.locator(xTicksSelector)).toHaveCount(0);
|
|
203
|
+
}));
|
|
204
|
+
(0, fixtures_1.test)("x-axis ticks are hidden when hideTickX is true", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
205
|
+
yield initTestBed(`
|
|
206
|
+
<LineChart
|
|
207
|
+
xKey="name"
|
|
208
|
+
data="{${sampleData}}"
|
|
209
|
+
yKeys="{['sales', 'profit']}"
|
|
210
|
+
hideTickX
|
|
211
|
+
width="600px"
|
|
212
|
+
height="400px"
|
|
213
|
+
/>
|
|
214
|
+
`);
|
|
215
|
+
yield page.waitForSelector(chartRoot, { timeout: 10000 });
|
|
216
|
+
// When hideTickX is true, ticks should not be rendered in DOM
|
|
217
|
+
yield (0, fixtures_1.expect)(page.locator(xTicksSelector)).toHaveCount(0);
|
|
218
|
+
// But the axis line itself should still be present (though not visible due to tickLine=false)
|
|
219
|
+
yield (0, fixtures_1.expect)(page.locator(xAxisSelector)).toBeAttached();
|
|
220
|
+
}));
|
|
221
|
+
});
|
|
222
|
+
fixtures_1.test.describe("y-axis", () => {
|
|
223
|
+
(0, fixtures_1.test)("y-axis is shown by default", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
224
|
+
yield initTestBed(`
|
|
225
|
+
<LineChart
|
|
226
|
+
xKey="name"
|
|
227
|
+
data="{${sampleData}}"
|
|
228
|
+
yKeys="{['sales', 'profit']}"
|
|
229
|
+
width="600px"
|
|
230
|
+
height="400px"
|
|
231
|
+
/>
|
|
232
|
+
`);
|
|
233
|
+
yield page.waitForSelector(chartRoot, { timeout: 10000 });
|
|
234
|
+
yield (0, fixtures_1.expect)(page.locator(yAxisSelector)).toBeVisible();
|
|
235
|
+
// Check that at least one tick is present
|
|
236
|
+
const tickCount = yield page.locator(yTicksSelector).count();
|
|
237
|
+
(0, fixtures_1.expect)(tickCount).toBeGreaterThan(0);
|
|
238
|
+
}));
|
|
239
|
+
(0, fixtures_1.test)("y-axis is hidden when hideY is true", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
240
|
+
yield initTestBed(`
|
|
241
|
+
<LineChart
|
|
242
|
+
xKey="name"
|
|
243
|
+
data="{${sampleData}}"
|
|
244
|
+
yKeys="{['sales', 'profit']}"
|
|
245
|
+
hideY
|
|
246
|
+
width="600px"
|
|
247
|
+
height="400px"
|
|
248
|
+
/>
|
|
249
|
+
`);
|
|
250
|
+
yield page.waitForSelector(chartRoot, { timeout: 10000 });
|
|
251
|
+
yield (0, fixtures_1.expect)(page.locator(yTicksSelector)).toHaveCount(0);
|
|
252
|
+
}));
|
|
253
|
+
(0, fixtures_1.test)("y-axis ticks are hidden when hideTickY is true", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
254
|
+
yield initTestBed(`
|
|
255
|
+
<LineChart
|
|
256
|
+
xKey="name"
|
|
257
|
+
data="{${sampleData}}"
|
|
258
|
+
yKeys="{['sales', 'profit']}"
|
|
259
|
+
hideTickY
|
|
260
|
+
width="600px"
|
|
261
|
+
height="400px"
|
|
262
|
+
/>
|
|
263
|
+
`);
|
|
264
|
+
yield page.waitForSelector(chartRoot, { timeout: 10000 });
|
|
265
|
+
// When hideTickY is true, ticks should not be rendered in DOM
|
|
266
|
+
yield (0, fixtures_1.expect)(page.locator(yTicksSelector)).toHaveCount(0);
|
|
267
|
+
// But the axis line itself should still be present (though not visible due to tickLine=false)
|
|
268
|
+
yield (0, fixtures_1.expect)(page.locator(yAxisSelector)).toBeAttached();
|
|
269
|
+
}));
|
|
270
|
+
});
|
|
271
|
+
// --- Formatter Tests
|
|
272
|
+
fixtures_1.test.describe("formatters", () => {
|
|
273
|
+
(0, fixtures_1.test)("applies tickFormatterX when provided", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
274
|
+
yield initTestBed(`
|
|
275
|
+
<LineChart
|
|
276
|
+
xKey="name"
|
|
277
|
+
data="{${sampleData}}"
|
|
278
|
+
yKeys="{['sales', 'profit']}"
|
|
279
|
+
tickFormatterX="{(value) => value + ' (X)'}"
|
|
280
|
+
width="600px"
|
|
281
|
+
height="400px"
|
|
282
|
+
/>
|
|
283
|
+
`);
|
|
284
|
+
yield page.waitForSelector(chartRoot, { timeout: 10000 });
|
|
285
|
+
// Check that formatted text appears in x-axis ticks
|
|
286
|
+
yield (0, fixtures_1.expect)(page.locator(xTicksSelector).first()).toContainText("(X)");
|
|
287
|
+
}));
|
|
288
|
+
(0, fixtures_1.test)("applies tickFormatterY when provided", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
289
|
+
yield initTestBed(`
|
|
290
|
+
<LineChart
|
|
291
|
+
xKey="name"
|
|
292
|
+
data="{${sampleData}}"
|
|
293
|
+
yKeys="{['sales', 'profit']}"
|
|
294
|
+
tickFormatterY="{(value) => '$' + value}"
|
|
295
|
+
width="600px"
|
|
296
|
+
height="400px"
|
|
297
|
+
/>
|
|
298
|
+
`);
|
|
299
|
+
yield page.waitForSelector(chartRoot, { timeout: 10000 });
|
|
300
|
+
// Check that formatted text appears in y-axis ticks
|
|
301
|
+
yield (0, fixtures_1.expect)(page.locator(yTicksSelector).first()).toContainText("$");
|
|
302
|
+
}));
|
|
303
|
+
});
|
|
304
|
+
// --- Margin Tests
|
|
305
|
+
fixtures_1.test.describe("margins", () => {
|
|
306
|
+
(0, fixtures_1.test)("applies custom margins", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
307
|
+
yield initTestBed(`
|
|
308
|
+
<LineChart
|
|
309
|
+
xKey="name"
|
|
310
|
+
data="{${sampleData}}"
|
|
311
|
+
yKeys="{['sales', 'profit']}"
|
|
312
|
+
marginTop="{20}"
|
|
313
|
+
marginRight="{30}"
|
|
314
|
+
marginBottom="{40}"
|
|
315
|
+
marginLeft="{50}"
|
|
316
|
+
width="600px"
|
|
317
|
+
height="400px"
|
|
318
|
+
/>
|
|
319
|
+
`);
|
|
320
|
+
yield page.waitForSelector(chartRoot, { timeout: 10000 });
|
|
321
|
+
// Chart should render with custom margins applied
|
|
322
|
+
yield (0, fixtures_1.expect)(page.locator(chartRoot)).toBeVisible();
|
|
323
|
+
}));
|
|
324
|
+
});
|
|
325
|
+
// --- Responsive Behavior Tests
|
|
326
|
+
fixtures_1.test.describe("responsive behavior", () => {
|
|
327
|
+
(0, fixtures_1.test)("enters mini mode with very small container height", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
328
|
+
yield initTestBed(`
|
|
329
|
+
<LineChart
|
|
330
|
+
xKey="name"
|
|
331
|
+
data="{${sampleData}}"
|
|
332
|
+
yKeys="{['sales', 'profit']}"
|
|
333
|
+
width="600px"
|
|
334
|
+
height="50px"
|
|
335
|
+
/>
|
|
336
|
+
`);
|
|
337
|
+
yield page.waitForSelector(chartRoot, { timeout: 10000 });
|
|
338
|
+
// In mini mode, x-axis ticks should be hidden (tick=false)
|
|
339
|
+
yield (0, fixtures_1.expect)(page.locator(xTicksSelector)).toHaveCount(0);
|
|
340
|
+
// Y-axis ticks should also be hidden in mini mode
|
|
341
|
+
yield (0, fixtures_1.expect)(page.locator(yTicksSelector)).toHaveCount(0);
|
|
342
|
+
// Chart should still render the lines
|
|
343
|
+
yield (0, fixtures_1.expect)(page.locator(linesSelector)).toHaveCount(2);
|
|
344
|
+
}));
|
|
345
|
+
(0, fixtures_1.test)("renders normally with adequate height", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
346
|
+
yield initTestBed(`
|
|
347
|
+
<LineChart
|
|
348
|
+
xKey="name"
|
|
349
|
+
data="{${sampleData}}"
|
|
350
|
+
yKeys="{['sales', 'profit']}"
|
|
351
|
+
width="600px"
|
|
352
|
+
height="200px"
|
|
353
|
+
/>
|
|
354
|
+
`);
|
|
355
|
+
yield page.waitForSelector(chartRoot, { timeout: 10000 });
|
|
356
|
+
// With adequate height, should have ticks
|
|
357
|
+
const tickCount = yield page.locator(xTicksSelector).count();
|
|
358
|
+
(0, fixtures_1.expect)(tickCount).toBeGreaterThan(0);
|
|
359
|
+
// Chart should render normally
|
|
360
|
+
yield (0, fixtures_1.expect)(page.locator(chartRoot)).toBeVisible();
|
|
361
|
+
}));
|
|
362
|
+
(0, fixtures_1.test)("adjusts tick intervals for narrow containers", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
363
|
+
yield initTestBed(`
|
|
364
|
+
<LineChart
|
|
365
|
+
xKey="name"
|
|
366
|
+
data="{${sampleData}}"
|
|
367
|
+
yKeys="{['sales', 'profit']}"
|
|
368
|
+
width="150px"
|
|
369
|
+
height="400px"
|
|
370
|
+
/>
|
|
371
|
+
`);
|
|
372
|
+
yield page.waitForSelector(chartRoot, { timeout: 10000 });
|
|
373
|
+
// Should still render with narrow width
|
|
374
|
+
yield (0, fixtures_1.expect)(page.locator(chartRoot)).toBeVisible();
|
|
375
|
+
yield (0, fixtures_1.expect)(page.locator(linesSelector)).toHaveCount(2);
|
|
376
|
+
}));
|
|
377
|
+
});
|
|
378
|
+
// --- Tooltip Template Tests
|
|
379
|
+
fixtures_1.test.describe("tooltipTemplate", () => {
|
|
380
|
+
(0, fixtures_1.test)("renders custom tooltip template", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
381
|
+
yield initTestBed(`
|
|
382
|
+
<LineChart
|
|
383
|
+
xKey="name"
|
|
384
|
+
data="{${sampleData}}"
|
|
385
|
+
yKeys="{['sales', 'profit']}"
|
|
386
|
+
width="600px"
|
|
387
|
+
height="400px"
|
|
388
|
+
>
|
|
389
|
+
<property name="tooltipTemplate">
|
|
390
|
+
<VStack>
|
|
391
|
+
<Text>Custom Tooltip</Text>
|
|
392
|
+
<Text>Label: {$tooltip.label}</Text>
|
|
393
|
+
<Text>Active: {$tooltip.active}</Text>
|
|
394
|
+
</VStack>
|
|
395
|
+
</property>
|
|
396
|
+
</LineChart>
|
|
397
|
+
`);
|
|
398
|
+
yield page.waitForSelector(chartRoot, { timeout: 10000 });
|
|
399
|
+
const chart = page.locator(chartSvg).first();
|
|
400
|
+
yield chart.hover({ position: { x: 200, y: 100 } });
|
|
401
|
+
// Wait for tooltip to appear
|
|
402
|
+
yield page.waitForTimeout(500);
|
|
403
|
+
yield (0, fixtures_1.expect)(page.locator(tooltipSelector)).toBeVisible();
|
|
404
|
+
// Check for custom tooltip content
|
|
405
|
+
yield (0, fixtures_1.expect)(page.getByText("Custom Tooltip")).toBeVisible();
|
|
406
|
+
yield (0, fixtures_1.expect)(page.getByText(/Label:/)).toBeVisible();
|
|
407
|
+
yield (0, fixtures_1.expect)(page.getByText(/Active:/)).toBeVisible();
|
|
408
|
+
}));
|
|
409
|
+
(0, fixtures_1.test)("tooltip template is not rendered when hideTooltip is true", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
410
|
+
yield initTestBed(`
|
|
411
|
+
<LineChart
|
|
412
|
+
xKey="name"
|
|
413
|
+
data="{${sampleData}}"
|
|
414
|
+
yKeys="{['sales', 'profit']}"
|
|
415
|
+
hideTooltip
|
|
416
|
+
width="600px"
|
|
417
|
+
height="400px"
|
|
418
|
+
>
|
|
419
|
+
<property name="tooltipTemplate">
|
|
420
|
+
<Text>This tooltip should not appear</Text>
|
|
421
|
+
</property>
|
|
422
|
+
</LineChart>
|
|
423
|
+
`);
|
|
424
|
+
yield page.waitForSelector(chartRoot, { timeout: 10000 });
|
|
425
|
+
const chart = page.locator(chartSvg).first();
|
|
426
|
+
yield chart.hover({ position: { x: 200, y: 100 } });
|
|
427
|
+
yield page.waitForTimeout(500);
|
|
428
|
+
yield (0, fixtures_1.expect)(page.locator(tooltipSelector)).not.toBeVisible();
|
|
429
|
+
yield (0, fixtures_1.expect)(page.getByText("This tooltip should not appear")).not.toBeVisible();
|
|
430
|
+
}));
|
|
431
|
+
(0, fixtures_1.test)("falls back to default tooltip when tooltipTemplate is not provided", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
432
|
+
yield initTestBed(`
|
|
433
|
+
<LineChart
|
|
434
|
+
xKey="name"
|
|
435
|
+
data="{${sampleData}}"
|
|
436
|
+
yKeys="{['sales', 'profit']}"
|
|
437
|
+
width="600px"
|
|
438
|
+
height="400px"
|
|
439
|
+
/>
|
|
440
|
+
`);
|
|
441
|
+
yield page.waitForSelector(chartRoot, { timeout: 10000 });
|
|
442
|
+
const chart = page.locator(chartSvg).first();
|
|
443
|
+
yield chart.hover({ position: { x: 200, y: 100 } });
|
|
444
|
+
yield page.waitForTimeout(500);
|
|
445
|
+
yield (0, fixtures_1.expect)(page.locator(tooltipSelector)).toBeVisible();
|
|
446
|
+
// Default tooltip should contain standard recharts tooltip content
|
|
447
|
+
const tooltip = page.locator(tooltipSelector);
|
|
448
|
+
yield (0, fixtures_1.expect)(tooltip).toBeVisible();
|
|
449
|
+
}));
|
|
450
|
+
});
|