xmlui 0.10.13 → 0.10.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/{index-Db5iQkFp.mjs → index-779mp2Bm.mjs} +943 -736
- package/dist/lib/index.css +1 -1
- package/dist/lib/{initMock-B9LtmFJG.mjs → initMock-CAXdczCj.mjs} +1 -1
- package/dist/lib/xmlui.d.ts +16 -1
- package/dist/lib/xmlui.mjs +33 -32
- package/dist/metadata/{collectedComponentMetadata-BN8eg9Gr.mjs → collectedComponentMetadata-7DFXlw-J.mjs} +15057 -14865
- package/dist/metadata/{initMock-J7pN8owj.mjs → initMock-AFWEftc6.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 +1 -1
- 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.spec.js +268 -0
- 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.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/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/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/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 +153 -0
- package/dist/scripts/src/components/NavGroup/NavGroupNative.js +2 -2
- 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 +1231 -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/Slider/Slider.js +2 -0
- package/dist/scripts/src/components/Slider/Slider.spec.js +574 -0
- package/dist/scripts/src/components/Slider/SliderNative.js +62 -25
- 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.spec.js +555 -0
- package/dist/scripts/src/components/Table/doc-resources/list-component-data.js +53 -0
- 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.spec.js +643 -0
- package/dist/scripts/src/components/Theme/Theme.spec.js +124 -0
- package/dist/scripts/src/components/TimeInput/TimeInput.spec.js +1122 -0
- 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/CompoundComponent.js +1 -1
- package/dist/scripts/src/components-core/RestApiProxy.js +85 -8
- package/dist/scripts/src/components-core/devtools/InspectorDialogVisibilityContext.js +8 -0
- package/dist/scripts/src/components-core/renderers.js +31 -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/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 +2 -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 +1355 -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/TimeInputDriver.js +22 -0
- package/dist/scripts/src/testing/drivers/TimerDriver.js +64 -0
- package/dist/scripts/src/testing/fixtures.js +487 -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 +18 -1
- package/dist/standalone/xmlui-standalone.umd.js +36 -36
- package/package.json +1 -1
|
@@ -0,0 +1,449 @@
|
|
|
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: 'Desktop', value: 400, fill: '#8884d8' },
|
|
16
|
+
{ name: 'Mobile', value: 300, fill: '#82ca9d' },
|
|
17
|
+
{ name: 'Tablet', value: 200, fill: '#ffc658' },
|
|
18
|
+
{ name: 'Other', value: 100, fill: '#ff7300' }
|
|
19
|
+
]`;
|
|
20
|
+
const multiSeriesData = `[
|
|
21
|
+
{ name: 'Jan', sales: 100, profit: 20, expenses: 80 },
|
|
22
|
+
{ name: 'Feb', sales: 150, profit: 30, expenses: 120 },
|
|
23
|
+
{ name: 'Mar', sales: 120, profit: 25, expenses: 95 },
|
|
24
|
+
{ name: 'Apr', sales: 180, profit: 40, expenses: 140 }
|
|
25
|
+
]`;
|
|
26
|
+
const largeValueData = `[
|
|
27
|
+
{ name: 'Category A', value: 1234567 },
|
|
28
|
+
{ name: 'Category B', value: 9876543 },
|
|
29
|
+
{ name: 'Category C', value: 5555555 }
|
|
30
|
+
]`;
|
|
31
|
+
// Chart selectors - Tooltip specific
|
|
32
|
+
const chartRoot = ".recharts-responsive-container";
|
|
33
|
+
const tooltipSelector = ".recharts-tooltip-wrapper";
|
|
34
|
+
const tooltipContentSelector = "[class*='tooltipContainer']";
|
|
35
|
+
const tooltipLabelSelector = ".label";
|
|
36
|
+
const tooltipIndicatorSelector = "[class*='indicator']";
|
|
37
|
+
const tooltipValueSelector = "[class*='valueText']";
|
|
38
|
+
const tooltipNameSelector = "[class*='mutedText']";
|
|
39
|
+
// =============================================================================
|
|
40
|
+
// BASIC FUNCTIONALITY TESTS
|
|
41
|
+
// =============================================================================
|
|
42
|
+
fixtures_1.test.describe("Basic Functionality", () => {
|
|
43
|
+
// Smoke tests
|
|
44
|
+
fixtures_1.test.describe("smoke tests", { tag: "@smoke" }, () => {
|
|
45
|
+
(0, fixtures_1.test)("TooltipContent renders in PieChart on hover", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
46
|
+
yield initTestBed(`
|
|
47
|
+
<PieChart
|
|
48
|
+
nameKey="name"
|
|
49
|
+
dataKey="value"
|
|
50
|
+
data="{${sampleData}}"
|
|
51
|
+
width="400px"
|
|
52
|
+
height="400px"
|
|
53
|
+
/>
|
|
54
|
+
`);
|
|
55
|
+
yield page.waitForSelector(chartRoot, { timeout: 10000 });
|
|
56
|
+
// Hover over a pie sector to trigger tooltip
|
|
57
|
+
const pieSector = page.locator(".recharts-pie-sector").first();
|
|
58
|
+
yield pieSector.hover();
|
|
59
|
+
// Tooltip should appear
|
|
60
|
+
yield (0, fixtures_1.expect)(page.locator(tooltipSelector)).toBeVisible();
|
|
61
|
+
yield (0, fixtures_1.expect)(page.locator(tooltipContentSelector)).toBeVisible();
|
|
62
|
+
}));
|
|
63
|
+
(0, fixtures_1.test)("TooltipContent renders in BarChart on hover", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
64
|
+
yield initTestBed(`
|
|
65
|
+
<BarChart
|
|
66
|
+
xKey="name"
|
|
67
|
+
yKeys="{['value']}"
|
|
68
|
+
data="{${sampleData}}"
|
|
69
|
+
width="400px"
|
|
70
|
+
height="400px"
|
|
71
|
+
/>
|
|
72
|
+
`);
|
|
73
|
+
yield page.waitForSelector(chartRoot, { timeout: 10000 });
|
|
74
|
+
// Hover over a bar to trigger tooltip
|
|
75
|
+
const barElement = page.locator(".recharts-bar-rectangle").first();
|
|
76
|
+
yield barElement.hover();
|
|
77
|
+
// Check if tooltip content is visible
|
|
78
|
+
yield (0, fixtures_1.expect)(page.locator(tooltipContentSelector)).toBeVisible();
|
|
79
|
+
yield (0, fixtures_1.expect)(page.locator(tooltipNameSelector)).toBeVisible();
|
|
80
|
+
yield (0, fixtures_1.expect)(page.locator(tooltipValueSelector)).toBeVisible();
|
|
81
|
+
}));
|
|
82
|
+
});
|
|
83
|
+
// Indicator prop tests
|
|
84
|
+
fixtures_1.test.describe("indicator prop", () => {
|
|
85
|
+
(0, fixtures_1.test)("displays dot indicator by default", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
86
|
+
yield initTestBed(`
|
|
87
|
+
<PieChart
|
|
88
|
+
nameKey="name"
|
|
89
|
+
dataKey="value"
|
|
90
|
+
data="{${sampleData}}"
|
|
91
|
+
width="400px"
|
|
92
|
+
height="400px"
|
|
93
|
+
/>
|
|
94
|
+
`);
|
|
95
|
+
yield page.waitForSelector(chartRoot, { timeout: 10000 });
|
|
96
|
+
const pieSector = page.locator(".recharts-pie-sector").first();
|
|
97
|
+
yield pieSector.hover();
|
|
98
|
+
yield (0, fixtures_1.expect)(page.locator(tooltipContentSelector)).toBeVisible();
|
|
99
|
+
const indicator = page.locator(tooltipIndicatorSelector);
|
|
100
|
+
yield (0, fixtures_1.expect)(indicator).toBeVisible();
|
|
101
|
+
// Should have dot styling (default)
|
|
102
|
+
yield (0, fixtures_1.expect)(indicator).toHaveClass(/dot/);
|
|
103
|
+
}));
|
|
104
|
+
(0, fixtures_1.test)("displays line indicator when specified", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
105
|
+
// Note: Since TooltipContent is used internally, we test through chart context
|
|
106
|
+
// The indicator prop would be passed through chart tooltip configuration
|
|
107
|
+
yield initTestBed(`
|
|
108
|
+
<BarChart
|
|
109
|
+
xKey="name"
|
|
110
|
+
yKeys="{['value']}"
|
|
111
|
+
data="{${sampleData}}"
|
|
112
|
+
width="400px"
|
|
113
|
+
height="400px"
|
|
114
|
+
/>
|
|
115
|
+
`);
|
|
116
|
+
yield page.waitForSelector(chartRoot, { timeout: 10000 });
|
|
117
|
+
// Hover over a bar to trigger tooltip
|
|
118
|
+
const barElement = page.locator(".recharts-bar-rectangle").first();
|
|
119
|
+
yield barElement.hover();
|
|
120
|
+
// Check if tooltip content is visible with proper styling
|
|
121
|
+
yield (0, fixtures_1.expect)(page.locator(tooltipContentSelector)).toBeVisible();
|
|
122
|
+
yield (0, fixtures_1.expect)(page.locator(tooltipNameSelector)).toBeVisible();
|
|
123
|
+
yield (0, fixtures_1.expect)(page.locator(tooltipValueSelector)).toBeVisible();
|
|
124
|
+
}));
|
|
125
|
+
});
|
|
126
|
+
// Data handling tests
|
|
127
|
+
fixtures_1.test.describe("data handling", () => {
|
|
128
|
+
(0, fixtures_1.test)("displays single data point correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
129
|
+
const singleData = `[{ name: 'Single', value: 100 }]`;
|
|
130
|
+
yield initTestBed(`
|
|
131
|
+
<PieChart
|
|
132
|
+
nameKey="name"
|
|
133
|
+
dataKey="value"
|
|
134
|
+
data="{${singleData}}"
|
|
135
|
+
width="400px"
|
|
136
|
+
height="400px"
|
|
137
|
+
/>
|
|
138
|
+
`);
|
|
139
|
+
yield page.waitForSelector(chartRoot, { timeout: 10000 });
|
|
140
|
+
const pieSector = page.locator(".recharts-pie-sector").first();
|
|
141
|
+
yield pieSector.hover();
|
|
142
|
+
yield (0, fixtures_1.expect)(page.locator(tooltipContentSelector)).toBeVisible();
|
|
143
|
+
yield (0, fixtures_1.expect)(page.locator(tooltipNameSelector)).toContainText("Single");
|
|
144
|
+
yield (0, fixtures_1.expect)(page.locator(tooltipValueSelector)).toContainText("100");
|
|
145
|
+
}));
|
|
146
|
+
(0, fixtures_1.test)("displays multiple data series correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
147
|
+
yield initTestBed(`
|
|
148
|
+
<BarChart
|
|
149
|
+
xKey="name"
|
|
150
|
+
yKeys="{['sales', 'profit']}"
|
|
151
|
+
data="{${multiSeriesData}}"
|
|
152
|
+
width="400px"
|
|
153
|
+
height="400px"
|
|
154
|
+
/>
|
|
155
|
+
`);
|
|
156
|
+
yield page.waitForSelector(chartRoot, { timeout: 10000 });
|
|
157
|
+
// Hover over a bar to trigger tooltip
|
|
158
|
+
const barElement = page.locator(".recharts-bar-rectangle").first();
|
|
159
|
+
yield barElement.hover();
|
|
160
|
+
// Check if tooltip shows multiple series data
|
|
161
|
+
yield (0, fixtures_1.expect)(page.locator(tooltipContentSelector)).toBeVisible();
|
|
162
|
+
// Should show data for both series - check for multiple indicators
|
|
163
|
+
const indicators = page.locator(tooltipIndicatorSelector);
|
|
164
|
+
yield (0, fixtures_1.expect)(indicators).toHaveCount(2);
|
|
165
|
+
}));
|
|
166
|
+
(0, fixtures_1.test)("formats large numbers with locale string", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
167
|
+
yield initTestBed(`
|
|
168
|
+
<PieChart
|
|
169
|
+
nameKey="name"
|
|
170
|
+
dataKey="value"
|
|
171
|
+
data="{${largeValueData}}"
|
|
172
|
+
width="400px"
|
|
173
|
+
height="400px"
|
|
174
|
+
/>
|
|
175
|
+
`);
|
|
176
|
+
yield page.waitForSelector(chartRoot, { timeout: 10000 });
|
|
177
|
+
const pieSector = page.locator(".recharts-pie-sector").first();
|
|
178
|
+
yield pieSector.hover();
|
|
179
|
+
yield (0, fixtures_1.expect)(page.locator(tooltipContentSelector)).toBeVisible();
|
|
180
|
+
// Should format large numbers with commas
|
|
181
|
+
const valueText = yield page.locator(tooltipValueSelector).textContent();
|
|
182
|
+
(0, fixtures_1.expect)(valueText).toMatch(/1,234,567/);
|
|
183
|
+
}));
|
|
184
|
+
(0, fixtures_1.test)("handles zero values correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
185
|
+
const zeroData = `[
|
|
186
|
+
{ name: 'Zero', value: 0 },
|
|
187
|
+
{ name: 'Positive', value: 100 }
|
|
188
|
+
]`;
|
|
189
|
+
yield initTestBed(`
|
|
190
|
+
<PieChart
|
|
191
|
+
nameKey="name"
|
|
192
|
+
dataKey="value"
|
|
193
|
+
data="{${zeroData}}"
|
|
194
|
+
width="400px"
|
|
195
|
+
height="400px"
|
|
196
|
+
/>
|
|
197
|
+
`);
|
|
198
|
+
yield page.waitForSelector(chartRoot, { timeout: 10000 });
|
|
199
|
+
const pieSector = page.locator(".recharts-pie-sector").first();
|
|
200
|
+
yield pieSector.hover();
|
|
201
|
+
yield (0, fixtures_1.expect)(page.locator(tooltipContentSelector)).toBeVisible();
|
|
202
|
+
// Should handle zero values gracefully
|
|
203
|
+
const valueElements = page.locator(tooltipValueSelector);
|
|
204
|
+
yield (0, fixtures_1.expect)(valueElements.first()).toBeVisible();
|
|
205
|
+
}));
|
|
206
|
+
});
|
|
207
|
+
// Label handling tests
|
|
208
|
+
fixtures_1.test.describe("label handling", () => {
|
|
209
|
+
(0, fixtures_1.test)("displays tooltip content without label by default", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
210
|
+
yield initTestBed(`
|
|
211
|
+
<PieChart
|
|
212
|
+
nameKey="name"
|
|
213
|
+
dataKey="value"
|
|
214
|
+
data="{${sampleData}}"
|
|
215
|
+
width="400px"
|
|
216
|
+
height="400px"
|
|
217
|
+
/>
|
|
218
|
+
`);
|
|
219
|
+
yield page.waitForSelector(chartRoot, { timeout: 10000 });
|
|
220
|
+
const pieSector = page.locator(".recharts-pie-sector").first();
|
|
221
|
+
yield pieSector.hover();
|
|
222
|
+
yield (0, fixtures_1.expect)(page.locator(tooltipContentSelector)).toBeVisible();
|
|
223
|
+
// Default PieChart tooltip doesn't have a label, so check for name and value instead
|
|
224
|
+
yield (0, fixtures_1.expect)(page.locator(tooltipNameSelector)).toBeVisible();
|
|
225
|
+
yield (0, fixtures_1.expect)(page.locator(tooltipValueSelector)).toBeVisible();
|
|
226
|
+
}));
|
|
227
|
+
(0, fixtures_1.test)("handles Unicode characters in labels", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
228
|
+
const unicodeData = `[
|
|
229
|
+
{ name: 'Desktop 🖥️', value: 400 },
|
|
230
|
+
{ name: 'Mobile 📱', value: 300 }
|
|
231
|
+
]`;
|
|
232
|
+
yield initTestBed(`
|
|
233
|
+
<PieChart
|
|
234
|
+
nameKey="name"
|
|
235
|
+
dataKey="value"
|
|
236
|
+
data="{${unicodeData}}"
|
|
237
|
+
width="400px"
|
|
238
|
+
height="400px"
|
|
239
|
+
/>
|
|
240
|
+
`);
|
|
241
|
+
yield page.waitForSelector(chartRoot, { timeout: 10000 });
|
|
242
|
+
const pieSector = page.locator(".recharts-pie-sector").first();
|
|
243
|
+
yield pieSector.hover();
|
|
244
|
+
yield (0, fixtures_1.expect)(page.locator(tooltipContentSelector)).toBeVisible();
|
|
245
|
+
// Should display Unicode characters correctly
|
|
246
|
+
const nameText = page.locator(tooltipNameSelector);
|
|
247
|
+
yield (0, fixtures_1.expect)(nameText).toContainText("🖥️");
|
|
248
|
+
}));
|
|
249
|
+
});
|
|
250
|
+
// Color and styling tests
|
|
251
|
+
fixtures_1.test.describe("color and styling", () => {
|
|
252
|
+
(0, fixtures_1.test)("displays indicator with correct colors", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
253
|
+
yield initTestBed(`
|
|
254
|
+
<PieChart
|
|
255
|
+
nameKey="name"
|
|
256
|
+
dataKey="value"
|
|
257
|
+
data="{${sampleData}}"
|
|
258
|
+
width="400px"
|
|
259
|
+
height="400px"
|
|
260
|
+
/>
|
|
261
|
+
`);
|
|
262
|
+
yield page.waitForSelector(chartRoot, { timeout: 10000 });
|
|
263
|
+
const pieSector = page.locator(".recharts-pie-sector").first();
|
|
264
|
+
yield pieSector.hover();
|
|
265
|
+
yield (0, fixtures_1.expect)(page.locator(tooltipContentSelector)).toBeVisible();
|
|
266
|
+
const indicator = page.locator(tooltipIndicatorSelector);
|
|
267
|
+
yield (0, fixtures_1.expect)(indicator).toBeVisible();
|
|
268
|
+
// Indicator should have background color
|
|
269
|
+
const backgroundColor = yield indicator.evaluate(el => window.getComputedStyle(el).backgroundColor);
|
|
270
|
+
(0, fixtures_1.expect)(backgroundColor).not.toBe("rgba(0, 0, 0, 0)"); // Not transparent
|
|
271
|
+
}));
|
|
272
|
+
(0, fixtures_1.test)("applies consistent styling across different chart types", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
273
|
+
// Test in LineChart context
|
|
274
|
+
yield initTestBed(`
|
|
275
|
+
<LineChart
|
|
276
|
+
xKey="name"
|
|
277
|
+
yKeys="{['value']}"
|
|
278
|
+
data="{${sampleData}}"
|
|
279
|
+
width="400px"
|
|
280
|
+
height="400px"
|
|
281
|
+
/>
|
|
282
|
+
`);
|
|
283
|
+
yield page.waitForSelector(chartRoot, { timeout: 10000 });
|
|
284
|
+
// Hover over line to trigger tooltip
|
|
285
|
+
const line = page.locator(".recharts-line-curve");
|
|
286
|
+
yield line.hover();
|
|
287
|
+
yield (0, fixtures_1.expect)(page.locator(tooltipContentSelector)).toBeVisible();
|
|
288
|
+
// Should have consistent styling
|
|
289
|
+
const indicator = page.locator(tooltipIndicatorSelector);
|
|
290
|
+
yield (0, fixtures_1.expect)(indicator).toBeVisible();
|
|
291
|
+
}));
|
|
292
|
+
});
|
|
293
|
+
});
|
|
294
|
+
// =============================================================================
|
|
295
|
+
// ACCESSIBILITY TESTS
|
|
296
|
+
// =============================================================================
|
|
297
|
+
fixtures_1.test.describe("Accessibility", () => {
|
|
298
|
+
(0, fixtures_1.test)("tooltip content is accessible to screen readers", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
299
|
+
yield initTestBed(`
|
|
300
|
+
<PieChart
|
|
301
|
+
nameKey="name"
|
|
302
|
+
dataKey="value"
|
|
303
|
+
data="{${sampleData}}"
|
|
304
|
+
width="400px"
|
|
305
|
+
height="400px"
|
|
306
|
+
/>
|
|
307
|
+
`);
|
|
308
|
+
yield page.waitForSelector(chartRoot, { timeout: 10000 });
|
|
309
|
+
const pieSector = page.locator(".recharts-pie-sector").first();
|
|
310
|
+
yield pieSector.hover();
|
|
311
|
+
yield (0, fixtures_1.expect)(page.locator(tooltipContentSelector)).toBeVisible();
|
|
312
|
+
// Tooltip content should be accessible
|
|
313
|
+
const tooltipContent = page.locator(tooltipContentSelector);
|
|
314
|
+
yield (0, fixtures_1.expect)(tooltipContent).toBeVisible();
|
|
315
|
+
// Text content should be readable
|
|
316
|
+
const nameText = page.locator(tooltipNameSelector);
|
|
317
|
+
const valueText = page.locator(tooltipValueSelector);
|
|
318
|
+
yield (0, fixtures_1.expect)(nameText).toBeVisible();
|
|
319
|
+
yield (0, fixtures_1.expect)(valueText).toBeVisible();
|
|
320
|
+
}));
|
|
321
|
+
(0, fixtures_1.test)("tooltip has proper contrast and readability", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
322
|
+
yield initTestBed(`
|
|
323
|
+
<PieChart
|
|
324
|
+
nameKey="name"
|
|
325
|
+
dataKey="value"
|
|
326
|
+
data="{${sampleData}}"
|
|
327
|
+
width="400px"
|
|
328
|
+
height="400px"
|
|
329
|
+
/>
|
|
330
|
+
`);
|
|
331
|
+
yield page.waitForSelector(chartRoot, { timeout: 10000 });
|
|
332
|
+
const pieSector = page.locator(".recharts-pie-sector").first();
|
|
333
|
+
yield pieSector.hover();
|
|
334
|
+
yield (0, fixtures_1.expect)(page.locator(tooltipContentSelector)).toBeVisible();
|
|
335
|
+
// Text should have readable font size
|
|
336
|
+
const valueText = page.locator(tooltipValueSelector);
|
|
337
|
+
yield (0, fixtures_1.expect)(valueText).toHaveCSS("font-size", /\d+px/);
|
|
338
|
+
// Should have proper contrast (background vs text)
|
|
339
|
+
const tooltipContainer = page.locator(tooltipContentSelector);
|
|
340
|
+
const backgroundColor = yield tooltipContainer.evaluate(el => window.getComputedStyle(el).backgroundColor);
|
|
341
|
+
(0, fixtures_1.expect)(backgroundColor).not.toBe("transparent");
|
|
342
|
+
}));
|
|
343
|
+
(0, fixtures_1.test)("tooltip appears on keyboard navigation", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
344
|
+
yield initTestBed(`
|
|
345
|
+
<PieChart
|
|
346
|
+
nameKey="name"
|
|
347
|
+
dataKey="value"
|
|
348
|
+
data="{${sampleData}}"
|
|
349
|
+
width="400px"
|
|
350
|
+
height="400px"
|
|
351
|
+
/>
|
|
352
|
+
`);
|
|
353
|
+
yield page.waitForSelector(chartRoot, { timeout: 10000 });
|
|
354
|
+
// Focus on chart and use keyboard navigation
|
|
355
|
+
yield page.keyboard.press("Tab");
|
|
356
|
+
// Chart should be focusable and tooltip may appear on focus
|
|
357
|
+
const focusedElement = page.locator(":focus");
|
|
358
|
+
yield (0, fixtures_1.expect)(focusedElement).toBeVisible();
|
|
359
|
+
}));
|
|
360
|
+
});
|
|
361
|
+
// =============================================================================
|
|
362
|
+
// PERFORMANCE AND EDGE CASES
|
|
363
|
+
// =============================================================================
|
|
364
|
+
fixtures_1.test.describe("Performance and Edge Cases", () => {
|
|
365
|
+
(0, fixtures_1.test)("handles rapid hover events efficiently", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
366
|
+
yield initTestBed(`
|
|
367
|
+
<PieChart
|
|
368
|
+
nameKey="name"
|
|
369
|
+
dataKey="value"
|
|
370
|
+
data="{${sampleData}}"
|
|
371
|
+
width="400px"
|
|
372
|
+
height="400px"
|
|
373
|
+
/>
|
|
374
|
+
`);
|
|
375
|
+
yield page.waitForSelector(chartRoot, { timeout: 10000 });
|
|
376
|
+
const sectors = page.locator(".recharts-pie-sector");
|
|
377
|
+
// Rapidly hover over different sectors
|
|
378
|
+
for (let i = 0; i < 3; i++) {
|
|
379
|
+
yield sectors.nth(i).hover();
|
|
380
|
+
yield page.waitForTimeout(100);
|
|
381
|
+
}
|
|
382
|
+
// Tooltip should still work correctly
|
|
383
|
+
yield sectors.first().hover();
|
|
384
|
+
yield (0, fixtures_1.expect)(page.locator(tooltipContentSelector)).toBeVisible();
|
|
385
|
+
}));
|
|
386
|
+
(0, fixtures_1.test)("handles empty or null data gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
387
|
+
const emptyData = `[]`;
|
|
388
|
+
yield initTestBed(`
|
|
389
|
+
<PieChart
|
|
390
|
+
nameKey="name"
|
|
391
|
+
dataKey="value"
|
|
392
|
+
data="{${emptyData}}"
|
|
393
|
+
width="400px"
|
|
394
|
+
height="400px"
|
|
395
|
+
/>
|
|
396
|
+
`);
|
|
397
|
+
yield page.waitForSelector(chartRoot, { timeout: 10000 });
|
|
398
|
+
// Should not crash with empty data
|
|
399
|
+
// Tooltip won't appear since there's no data to hover over
|
|
400
|
+
const chart = page.locator(chartRoot);
|
|
401
|
+
yield (0, fixtures_1.expect)(chart).toBeVisible();
|
|
402
|
+
}));
|
|
403
|
+
(0, fixtures_1.test)("handles special characters and long text", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
404
|
+
yield initTestBed(`
|
|
405
|
+
<PieChart
|
|
406
|
+
nameKey="name"
|
|
407
|
+
dataKey="value"
|
|
408
|
+
data="{[
|
|
409
|
+
{ name: 'Category with quotes & symbols', value: 400 },
|
|
410
|
+
{ name: 'Very long category name that might wrap to multiple lines in the tooltip', value: 300 }
|
|
411
|
+
]}"
|
|
412
|
+
width="400px"
|
|
413
|
+
height="400px"
|
|
414
|
+
/>
|
|
415
|
+
`);
|
|
416
|
+
yield page.waitForSelector(chartRoot, { timeout: 10000 });
|
|
417
|
+
const pieSector = page.locator(".recharts-pie-sector").first();
|
|
418
|
+
yield pieSector.hover();
|
|
419
|
+
yield (0, fixtures_1.expect)(page.locator(tooltipContentSelector)).toBeVisible();
|
|
420
|
+
// Should handle special characters correctly
|
|
421
|
+
const nameText = page.locator(tooltipNameSelector);
|
|
422
|
+
yield (0, fixtures_1.expect)(nameText).toContainText("quotes");
|
|
423
|
+
yield (0, fixtures_1.expect)(page.locator(tooltipValueSelector)).toContainText("400");
|
|
424
|
+
}));
|
|
425
|
+
(0, fixtures_1.test)("tooltip positioning adapts to chart boundaries", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
426
|
+
yield initTestBed(`
|
|
427
|
+
<PieChart
|
|
428
|
+
nameKey="name"
|
|
429
|
+
dataKey="value"
|
|
430
|
+
data="{${sampleData}}"
|
|
431
|
+
width="200px"
|
|
432
|
+
height="200px"
|
|
433
|
+
/>
|
|
434
|
+
`);
|
|
435
|
+
yield page.waitForSelector(chartRoot, { timeout: 10000 });
|
|
436
|
+
// Hover near edge of small chart
|
|
437
|
+
const pieSector = page.locator(".recharts-pie-sector").first();
|
|
438
|
+
yield pieSector.hover();
|
|
439
|
+
yield (0, fixtures_1.expect)(page.locator(tooltipContentSelector)).toBeVisible();
|
|
440
|
+
// Tooltip should be positioned within viewport
|
|
441
|
+
const tooltip = page.locator(tooltipSelector);
|
|
442
|
+
const boundingBox = yield tooltip.boundingBox();
|
|
443
|
+
(0, fixtures_1.expect)(boundingBox).toBeTruthy();
|
|
444
|
+
if (boundingBox) {
|
|
445
|
+
(0, fixtures_1.expect)(boundingBox.x).toBeGreaterThanOrEqual(0);
|
|
446
|
+
(0, fixtures_1.expect)(boundingBox.y).toBeGreaterThanOrEqual(0);
|
|
447
|
+
}
|
|
448
|
+
}));
|
|
449
|
+
});
|