xmlui 0.10.12 → 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-CDOoBf2R.mjs → index-779mp2Bm.mjs} +1508 -1287
- package/dist/lib/index.css +1 -1
- package/dist/lib/{initMock-BAV9RKui.mjs → initMock-CAXdczCj.mjs} +1 -1
- package/dist/lib/scss/components-core/theming/_themes.scss +1 -1
- package/dist/lib/xmlui.d.ts +17 -2
- package/dist/lib/xmlui.mjs +33 -32
- package/dist/metadata/{collectedComponentMetadata-Dp8BqWQO.mjs → collectedComponentMetadata-7DFXlw-J.mjs} +14957 -14751
- package/dist/metadata/{initMock-BvEO8W8r.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.js +3 -3
- package/dist/scripts/src/components/ColorPicker/ColorPicker.spec.js +283 -0
- package/dist/scripts/src/components/ColorPicker/ColorPickerNative.js +16 -5
- package/dist/scripts/src/components/Column/doc-resources/list-component-data.js +53 -0
- package/dist/scripts/src/components/ComponentProvider.js +6 -6
- 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 +1 -1
- 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/FileInput/FileInputNative.js +14 -10
- package/dist/scripts/src/components/FileUploadDropZone/FileUploadDropZone.spec.js +296 -0
- package/dist/scripts/src/components/FileUploadDropZone/FileUploadDropZoneNative.js +1 -1
- 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.js +6 -0
- package/dist/scripts/src/components/Form/Form.spec.js +1257 -0
- package/dist/scripts/src/components/Form/FormNative.js +13 -3
- package/dist/scripts/src/components/FormItem/FormItem.spec.js +723 -0
- package/dist/scripts/src/components/FormItem/ItemWithLabel.js +2 -2
- package/dist/scripts/src/components/FormSection/FormSection.js +6 -31
- package/dist/scripts/src/components/Fragment/Fragment.js +5 -1
- 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.js +0 -12
- 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.js +1 -1
- package/dist/scripts/src/components/ModalDialog/ModalDialog.spec.js +162 -0
- package/dist/scripts/src/components/ModalDialog/ModalDialogNative.js +1 -1
- 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/RadioGroup/RadioGroupNative.js +17 -1
- 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.js +8 -5
- package/dist/scripts/src/components/Table/Table.spec.js +555 -0
- package/dist/scripts/src/components/Table/TableNative.js +1 -1
- 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.js +0 -13
- 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/TextArea/TextAreaNative.js +8 -1
- package/dist/scripts/src/components/TextBox/TextBox.spec.js +643 -0
- package/dist/scripts/src/components/Theme/NotificationToast.js +4 -1
- 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 +5 -5
- package/dist/scripts/src/components-core/RestApiProxy.js +89 -11
- 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/rendering/ComponentAdapter.js +1 -1
- package/dist/scripts/src/components-core/rendering/Container.js +19 -8
- package/dist/scripts/src/components-core/rendering/reducer.js +1 -1
- 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/root.js +13 -20
- 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 +19 -2
- package/dist/standalone/xmlui-standalone.umd.js +36 -36
- package/package.json +1 -1
- package/dist/scripts/src/components/RadioGroup/RadioItem.js +0 -28
|
@@ -0,0 +1,196 @@
|
|
|
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
|
+
// =============================================================================
|
|
14
|
+
// BASIC FUNCTIONALITY TESTS
|
|
15
|
+
// =============================================================================
|
|
16
|
+
(0, fixtures_1.test)("component renders with basic props", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createCodeBlockDriver }) {
|
|
17
|
+
yield initTestBed(`<CodeBlock />`);
|
|
18
|
+
const driver = yield createCodeBlockDriver();
|
|
19
|
+
yield (0, fixtures_1.expect)(driver.component).toBeVisible();
|
|
20
|
+
}));
|
|
21
|
+
(0, fixtures_1.test)("component renders with Text content", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createCodeBlockDriver }) {
|
|
22
|
+
yield initTestBed(`
|
|
23
|
+
<CodeBlock>
|
|
24
|
+
<Text variant="codefence">const hello = "world";</Text>
|
|
25
|
+
</CodeBlock>
|
|
26
|
+
`);
|
|
27
|
+
const driver = yield createCodeBlockDriver();
|
|
28
|
+
yield (0, fixtures_1.expect)(driver.component).toBeVisible();
|
|
29
|
+
yield (0, fixtures_1.expect)(driver.getContent()).toContainText("const hello = \"world\";");
|
|
30
|
+
}));
|
|
31
|
+
(0, fixtures_1.test)("component renders with children content", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createCodeBlockDriver }) {
|
|
32
|
+
yield initTestBed(`
|
|
33
|
+
<CodeBlock>
|
|
34
|
+
<pre><code>function test() { return 42; }</code></pre>
|
|
35
|
+
</CodeBlock>
|
|
36
|
+
`);
|
|
37
|
+
const driver = yield createCodeBlockDriver();
|
|
38
|
+
yield (0, fixtures_1.expect)(driver.component).toBeVisible();
|
|
39
|
+
yield (0, fixtures_1.expect)(driver.getContent()).toContainText("function test() { return 42; }");
|
|
40
|
+
}));
|
|
41
|
+
// =============================================================================
|
|
42
|
+
// ACCESSIBILITY TESTS
|
|
43
|
+
// =============================================================================
|
|
44
|
+
(0, fixtures_1.test)("component has proper semantic structure", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createCodeBlockDriver }) {
|
|
45
|
+
yield initTestBed(`
|
|
46
|
+
<CodeBlock>
|
|
47
|
+
<Text variant="codefence">const x = 1;</Text>
|
|
48
|
+
</CodeBlock>
|
|
49
|
+
`);
|
|
50
|
+
const driver = yield createCodeBlockDriver();
|
|
51
|
+
yield (0, fixtures_1.expect)(driver.component).toBeVisible();
|
|
52
|
+
// CodeBlock should be identifiable as a code container
|
|
53
|
+
yield (0, fixtures_1.expect)(driver.component).toHaveClass(/codeBlock/);
|
|
54
|
+
}));
|
|
55
|
+
(0, fixtures_1.test)("component content is accessible to screen readers", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createCodeBlockDriver }) {
|
|
56
|
+
yield initTestBed(`
|
|
57
|
+
<CodeBlock>
|
|
58
|
+
<Text variant="codefence">function accessible() { return true; }</Text>
|
|
59
|
+
</CodeBlock>
|
|
60
|
+
`);
|
|
61
|
+
const driver = yield createCodeBlockDriver();
|
|
62
|
+
// Code content should be readable
|
|
63
|
+
const codeText = yield driver.getCodeText();
|
|
64
|
+
(0, fixtures_1.expect)(codeText).toContain("function accessible() { return true; }");
|
|
65
|
+
}));
|
|
66
|
+
// =============================================================================
|
|
67
|
+
// VISUAL STATE TESTS
|
|
68
|
+
// =============================================================================
|
|
69
|
+
(0, fixtures_1.test)("component applies theme variables correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createCodeBlockDriver }) {
|
|
70
|
+
yield initTestBed(`<CodeBlock />`, {
|
|
71
|
+
testThemeVars: {
|
|
72
|
+
"backgroundColor-CodeBlock": "rgb(255, 0, 0)",
|
|
73
|
+
"borderRadius-CodeBlock": "8px",
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
const driver = yield createCodeBlockDriver();
|
|
77
|
+
yield (0, fixtures_1.expect)(driver.component).toHaveCSS("background-color", "rgb(255, 0, 0)");
|
|
78
|
+
yield (0, fixtures_1.expect)(driver.component).toHaveCSS("border-radius", "8px");
|
|
79
|
+
}));
|
|
80
|
+
// =============================================================================
|
|
81
|
+
// EDGE CASE TESTS
|
|
82
|
+
// =============================================================================
|
|
83
|
+
(0, fixtures_1.test)("component handles null and undefined props gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createCodeBlockDriver }) {
|
|
84
|
+
yield initTestBed(`<CodeBlock/>`);
|
|
85
|
+
const driver = yield createCodeBlockDriver();
|
|
86
|
+
yield (0, fixtures_1.expect)(driver.component).toBeVisible();
|
|
87
|
+
}));
|
|
88
|
+
(0, fixtures_1.test)("component handles empty content", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createCodeBlockDriver }) {
|
|
89
|
+
yield initTestBed(`<CodeBlock></CodeBlock>`);
|
|
90
|
+
const driver = yield createCodeBlockDriver();
|
|
91
|
+
yield (0, fixtures_1.expect)(driver.component).toBeVisible();
|
|
92
|
+
yield (0, fixtures_1.expect)(driver.getContent()).toBeVisible();
|
|
93
|
+
}));
|
|
94
|
+
(0, fixtures_1.test)("component handles special characters in code", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createCodeBlockDriver }) {
|
|
95
|
+
yield initTestBed(`
|
|
96
|
+
<CodeBlock>
|
|
97
|
+
<Text variant="codefence">const emoji = "🚀"; const unicode = "émojis"; const quotes = '"test"';</Text>
|
|
98
|
+
</CodeBlock>
|
|
99
|
+
`);
|
|
100
|
+
const driver = yield createCodeBlockDriver();
|
|
101
|
+
yield (0, fixtures_1.expect)(driver.component).toBeVisible();
|
|
102
|
+
yield (0, fixtures_1.expect)(driver.getContent()).toContainText('const emoji = "🚀"');
|
|
103
|
+
yield (0, fixtures_1.expect)(driver.getContent()).toContainText("émojis");
|
|
104
|
+
}));
|
|
105
|
+
(0, fixtures_1.test)("component handles very long code content", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createCodeBlockDriver }) {
|
|
106
|
+
const longCode = "const veryLongVariableName = ".repeat(100) + '"end";';
|
|
107
|
+
yield initTestBed(`
|
|
108
|
+
<CodeBlock>
|
|
109
|
+
<Text variant="codefence">${longCode}</Text>
|
|
110
|
+
</CodeBlock>
|
|
111
|
+
`);
|
|
112
|
+
const driver = yield createCodeBlockDriver();
|
|
113
|
+
yield (0, fixtures_1.expect)(driver.component).toBeVisible();
|
|
114
|
+
yield (0, fixtures_1.expect)(driver.getContent()).toContainText("end");
|
|
115
|
+
}));
|
|
116
|
+
(0, fixtures_1.test)("component handles invalid meta prop gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createCodeBlockDriver }) {
|
|
117
|
+
yield initTestBed(`
|
|
118
|
+
<CodeBlock meta="invalid">
|
|
119
|
+
<Text variant="codefence">test code</Text>
|
|
120
|
+
</CodeBlock>
|
|
121
|
+
`);
|
|
122
|
+
const driver = yield createCodeBlockDriver();
|
|
123
|
+
yield (0, fixtures_1.expect)(driver.component).toBeVisible();
|
|
124
|
+
}));
|
|
125
|
+
// =============================================================================
|
|
126
|
+
// INTEGRATION TESTS
|
|
127
|
+
// =============================================================================
|
|
128
|
+
(0, fixtures_1.test)("component works correctly in different layout contexts", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createCodeBlockDriver }) {
|
|
129
|
+
yield initTestBed(`
|
|
130
|
+
<VStack>
|
|
131
|
+
<Text>Code example:</Text>
|
|
132
|
+
<CodeBlock>
|
|
133
|
+
<Text variant="codefence">const layout = 'test';</Text>
|
|
134
|
+
</CodeBlock>
|
|
135
|
+
<Text>End of example</Text>
|
|
136
|
+
</VStack>
|
|
137
|
+
`);
|
|
138
|
+
const driver = yield createCodeBlockDriver();
|
|
139
|
+
yield (0, fixtures_1.expect)(driver.component).toBeVisible();
|
|
140
|
+
yield (0, fixtures_1.expect)(driver.getContent()).toContainText("const layout = 'test';");
|
|
141
|
+
}));
|
|
142
|
+
(0, fixtures_1.test)("component handles multiline code content", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createCodeBlockDriver }) {
|
|
143
|
+
yield initTestBed(`
|
|
144
|
+
<CodeBlock>
|
|
145
|
+
<Text variant="codefence">function example() {
|
|
146
|
+
return "multiline test";
|
|
147
|
+
}</Text>
|
|
148
|
+
</CodeBlock>
|
|
149
|
+
`);
|
|
150
|
+
const driver = yield createCodeBlockDriver();
|
|
151
|
+
yield (0, fixtures_1.expect)(driver.component).toBeVisible();
|
|
152
|
+
yield (0, fixtures_1.expect)(driver.getContent()).toContainText("function example()");
|
|
153
|
+
yield (0, fixtures_1.expect)(driver.getContent()).toContainText("return \"multiline test\"");
|
|
154
|
+
}));
|
|
155
|
+
(0, fixtures_1.test)("component applies global CSS class correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createCodeBlockDriver }) {
|
|
156
|
+
yield initTestBed(`<CodeBlock />`);
|
|
157
|
+
const driver = yield createCodeBlockDriver();
|
|
158
|
+
yield (0, fixtures_1.expect)(driver.component).toHaveClass(/global-codeBlock/);
|
|
159
|
+
}));
|
|
160
|
+
(0, fixtures_1.test)("component maintains consistent styling across themes", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createCodeBlockDriver }) {
|
|
161
|
+
// Test light theme
|
|
162
|
+
yield initTestBed(`<CodeBlock />`, {
|
|
163
|
+
testThemeVars: {
|
|
164
|
+
"backgroundColor-CodeBlock": "rgb(248, 249, 250)",
|
|
165
|
+
"border-CodeBlock": "1px solid rgb(208, 215, 222)",
|
|
166
|
+
},
|
|
167
|
+
});
|
|
168
|
+
let driver = yield createCodeBlockDriver();
|
|
169
|
+
yield (0, fixtures_1.expect)(driver.component).toHaveCSS("background-color", "rgb(248, 249, 250)");
|
|
170
|
+
// Test dark theme
|
|
171
|
+
yield initTestBed(`<CodeBlock />`, {
|
|
172
|
+
testThemeVars: {
|
|
173
|
+
"backgroundColor-CodeBlock": "rgb(22, 27, 34)",
|
|
174
|
+
"border-CodeBlock": "1px solid rgb(48, 54, 61)",
|
|
175
|
+
},
|
|
176
|
+
});
|
|
177
|
+
driver = yield createCodeBlockDriver();
|
|
178
|
+
yield (0, fixtures_1.expect)(driver.component).toHaveCSS("background-color", "rgb(22, 27, 34)");
|
|
179
|
+
}));
|
|
180
|
+
// --- Smoke Tests (maintaining existing)
|
|
181
|
+
fixtures_1.test.describe("smoke tests", { tag: "@smoke" }, () => {
|
|
182
|
+
(0, fixtures_1.test)("component renders", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createCodeBlockDriver }) {
|
|
183
|
+
yield initTestBed(`<CodeBlock />`);
|
|
184
|
+
yield (0, fixtures_1.expect)((yield createCodeBlockDriver()).component).toBeAttached();
|
|
185
|
+
}));
|
|
186
|
+
(0, fixtures_1.test)("component with Text codefence renders", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createCodeBlockDriver }) {
|
|
187
|
+
yield initTestBed(`
|
|
188
|
+
<CodeBlock>
|
|
189
|
+
<Text variant="codefence">
|
|
190
|
+
This is a test
|
|
191
|
+
</Text>
|
|
192
|
+
</CodeBlock>
|
|
193
|
+
`);
|
|
194
|
+
yield (0, fixtures_1.expect)((yield createCodeBlockDriver()).component).toBeAttached();
|
|
195
|
+
}));
|
|
196
|
+
});
|
|
@@ -52,7 +52,7 @@ exports.ColorPickerMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
52
52
|
});
|
|
53
53
|
exports.colorPickerComponentRenderer = (0, renderers_1.createComponentRenderer)("ColorPicker", exports.ColorPickerMd, ({ node, extractValue, className, state, lookupEventHandler, registerComponentApi, updateState, }) => {
|
|
54
54
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
55
|
-
const
|
|
56
|
-
const
|
|
57
|
-
return ((0, jsx_runtime_1.jsx)(ColorPickerNative_1.ColorPicker, { validationStatus: extractValue(node.props.validationStatus), value: state.value, initialValue: extractValue(node.props.initialValue), updateState: updateState, onDidChange: lookupEventHandler("didChange"), onFocus: lookupEventHandler("gotFocus"), onBlur: lookupEventHandler("lostFocus"), registerComponentApi: registerComponentApi, className: className, required: extractValue.asOptionalBoolean((_c = node.props) === null || _c === void 0 ? void 0 : _c.required), enabled: enabled && !
|
|
55
|
+
const readOnly = extractValue.asOptionalBoolean((_a = node.props) === null || _a === void 0 ? void 0 : _a.readOnly, false);
|
|
56
|
+
const enabled = extractValue.asOptionalBoolean((_b = node.props) === null || _b === void 0 ? void 0 : _b.enabled, true);
|
|
57
|
+
return ((0, jsx_runtime_1.jsx)(ColorPickerNative_1.ColorPicker, { validationStatus: extractValue(node.props.validationStatus), value: state.value, initialValue: extractValue(node.props.initialValue), updateState: updateState, onDidChange: lookupEventHandler("didChange"), onFocus: lookupEventHandler("gotFocus"), onBlur: lookupEventHandler("lostFocus"), registerComponentApi: registerComponentApi, className: className, required: extractValue.asOptionalBoolean((_c = node.props) === null || _c === void 0 ? void 0 : _c.required), enabled: enabled && !readOnly, readOnly: readOnly, autoFocus: extractValue.asOptionalBoolean((_d = node.props) === null || _d === void 0 ? void 0 : _d.autoFocus), label: extractValue((_e = node.props) === null || _e === void 0 ? void 0 : _e.label), labelPosition: extractValue((_f = node.props) === null || _f === void 0 ? void 0 : _f.labelPosition), labelBreak: extractValue((_g = node.props) === null || _g === void 0 ? void 0 : _g.labelBreak), labelWidth: extractValue((_h = node.props) === null || _h === void 0 ? void 0 : _h.labelWidth) }));
|
|
58
58
|
});
|
|
@@ -0,0 +1,283 @@
|
|
|
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
|
+
// =============================================================================
|
|
14
|
+
// BASIC FUNCTIONALITY TESTS
|
|
15
|
+
// =============================================================================
|
|
16
|
+
(0, fixtures_1.test)("component renders with default value", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
17
|
+
yield initTestBed(`<ColorPicker />`, {});
|
|
18
|
+
// Check that the component is visible
|
|
19
|
+
yield (0, fixtures_1.expect)(page.locator("input[type='color']")).toBeVisible();
|
|
20
|
+
// Check default color (#000000 - black)
|
|
21
|
+
yield (0, fixtures_1.expect)(page.locator("input[type='color']")).toHaveValue("#000000");
|
|
22
|
+
}));
|
|
23
|
+
(0, fixtures_1.test)("component updates when value changes", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
24
|
+
const COLOR_1 = "#ff0000"; // Red
|
|
25
|
+
const COLOR_2 = "#00ff00"; // Green
|
|
26
|
+
yield initTestBed(`<ColorPicker initialValue="${COLOR_1}" />`, {});
|
|
27
|
+
// Check that the initial color is set correctly
|
|
28
|
+
const colorInput = page.locator("input[type='color']");
|
|
29
|
+
yield (0, fixtures_1.expect)(colorInput).toHaveValue(COLOR_1);
|
|
30
|
+
// Change the color
|
|
31
|
+
yield colorInput.fill(COLOR_2); // Green
|
|
32
|
+
yield (0, fixtures_1.expect)(colorInput).toHaveValue(COLOR_2);
|
|
33
|
+
}));
|
|
34
|
+
(0, fixtures_1.test)("component renders label correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
35
|
+
yield initTestBed(`<ColorPicker label="Select Color" />`);
|
|
36
|
+
// Check that the label is displayed
|
|
37
|
+
const label = page.locator("label");
|
|
38
|
+
yield (0, fixtures_1.expect)(label).toBeVisible();
|
|
39
|
+
yield (0, fixtures_1.expect)(label).toContainText("Select Color");
|
|
40
|
+
}));
|
|
41
|
+
(0, fixtures_1.test)("component handles disabled state correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
42
|
+
yield initTestBed(`<ColorPicker enabled="false" />`, {});
|
|
43
|
+
// Check that the input is disabled
|
|
44
|
+
const colorInput = page.locator("input[type='color']");
|
|
45
|
+
yield (0, fixtures_1.expect)(colorInput).toBeDisabled();
|
|
46
|
+
}));
|
|
47
|
+
(0, fixtures_1.test)("component handles enabled state correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
48
|
+
yield initTestBed(`<ColorPicker enabled="true" />`, {});
|
|
49
|
+
// Check that the input is disabled
|
|
50
|
+
const colorInput = page.locator("input[type='color']");
|
|
51
|
+
yield (0, fixtures_1.expect)(colorInput).toBeEnabled();
|
|
52
|
+
}));
|
|
53
|
+
(0, fixtures_1.test)("component fires didChange event when color is selected", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
54
|
+
const COLOR_1 = "#ff0000"; // Red
|
|
55
|
+
const COLOR_2 = "#00ff00"; // Green
|
|
56
|
+
const { testStateDriver } = yield initTestBed(`
|
|
57
|
+
<ColorPicker initialValue="${COLOR_1}" onDidChange="(value) => testState = value" />
|
|
58
|
+
`);
|
|
59
|
+
// Change the color
|
|
60
|
+
yield page.locator("input[type='color']").fill(COLOR_2);
|
|
61
|
+
// Check that the event fired with the new color value
|
|
62
|
+
yield fixtures_1.expect.poll(() => testStateDriver.testState()).toEqual(COLOR_2);
|
|
63
|
+
}));
|
|
64
|
+
(0, fixtures_1.test)("component's gotFocus event fires", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
65
|
+
const { testStateDriver } = yield initTestBed(`
|
|
66
|
+
<ColorPicker initialValue="#FF0000" onGotFocus="testState = 'focused'" />
|
|
67
|
+
`);
|
|
68
|
+
const colorInput = page.locator("input[type='color']");
|
|
69
|
+
// Focus the input
|
|
70
|
+
yield colorInput.focus();
|
|
71
|
+
// Verify the input is focused
|
|
72
|
+
yield (0, fixtures_1.expect)(colorInput).toBeFocused();
|
|
73
|
+
// Verify the focus event fired
|
|
74
|
+
yield fixtures_1.expect.poll(testStateDriver.testState).toEqual("focused");
|
|
75
|
+
}));
|
|
76
|
+
// =============================================================================
|
|
77
|
+
// ACCESSIBILITY TESTS
|
|
78
|
+
// =============================================================================
|
|
79
|
+
(0, fixtures_1.test)("component has correct accessibility attributes", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
80
|
+
yield initTestBed(`<ColorPicker label="Select Color" />`, {});
|
|
81
|
+
// Check that the input has a valid label association
|
|
82
|
+
const colorInput = page.locator("input[type='color']");
|
|
83
|
+
const inputId = yield colorInput.getAttribute("id");
|
|
84
|
+
const label = page.locator("label");
|
|
85
|
+
(0, fixtures_1.expect)(inputId).toBeTruthy();
|
|
86
|
+
yield (0, fixtures_1.expect)(label).toHaveAttribute("for", inputId);
|
|
87
|
+
}));
|
|
88
|
+
(0, fixtures_1.test)("component is keyboard accessible", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
89
|
+
const { testStateDriver } = yield initTestBed(`
|
|
90
|
+
<ColorPicker initialValue="#FF0000" onGotFocus="testState = 'focused'" />
|
|
91
|
+
`);
|
|
92
|
+
const colorInput = page.locator("input[type='color']");
|
|
93
|
+
// Focus the input
|
|
94
|
+
yield page.keyboard.press("Tab");
|
|
95
|
+
// Verify the input is focused
|
|
96
|
+
yield (0, fixtures_1.expect)(colorInput).toBeFocused();
|
|
97
|
+
// Verify the focus event fired
|
|
98
|
+
yield fixtures_1.expect.poll(testStateDriver.testState).toEqual("focused");
|
|
99
|
+
}));
|
|
100
|
+
// =============================================================================
|
|
101
|
+
// VISUAL STATE TESTS
|
|
102
|
+
// =============================================================================
|
|
103
|
+
(0, fixtures_1.test)("component shows different validation states correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
104
|
+
// Error state
|
|
105
|
+
yield initTestBed(`<ColorPicker validationStatus="error" />`, {});
|
|
106
|
+
let colorInput = page.locator("input[type='color']");
|
|
107
|
+
yield (0, fixtures_1.expect)(colorInput).toHaveClass(/error/);
|
|
108
|
+
// Warning state
|
|
109
|
+
yield initTestBed(`<ColorPicker validationStatus="warning" />`, {});
|
|
110
|
+
colorInput = page.locator("input[type='color']");
|
|
111
|
+
yield (0, fixtures_1.expect)(colorInput).toHaveClass(/warning/);
|
|
112
|
+
// Valid state
|
|
113
|
+
yield initTestBed(`<ColorPicker validationStatus="valid" />`, {});
|
|
114
|
+
colorInput = page.locator("input[type='color']");
|
|
115
|
+
yield (0, fixtures_1.expect)(colorInput).toHaveClass(/valid/);
|
|
116
|
+
}));
|
|
117
|
+
(0, fixtures_1.test)("component applies backgroundColor-ColorPicker theme variable", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
118
|
+
yield initTestBed(`<ColorPicker />`, {
|
|
119
|
+
testThemeVars: {
|
|
120
|
+
"backgroundColor-ColorPicker": "rgb(240, 240, 240)",
|
|
121
|
+
},
|
|
122
|
+
});
|
|
123
|
+
const colorInput = page.locator("input[type='color']");
|
|
124
|
+
yield (0, fixtures_1.expect)(colorInput).toHaveCSS("background-color", "rgb(240, 240, 240)");
|
|
125
|
+
}));
|
|
126
|
+
(0, fixtures_1.test)("component applies borderColor-ColorPicker theme variable", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
127
|
+
yield initTestBed(`<ColorPicker />`, {
|
|
128
|
+
testThemeVars: {
|
|
129
|
+
"borderColor-ColorPicker": "rgb(255, 0, 0)",
|
|
130
|
+
},
|
|
131
|
+
});
|
|
132
|
+
const colorInput = page.locator("input[type='color']");
|
|
133
|
+
yield (0, fixtures_1.expect)(colorInput).toHaveCSS("border-color", "rgb(255, 0, 0)");
|
|
134
|
+
}));
|
|
135
|
+
(0, fixtures_1.test)("component applies borderColor-ColorPicker--hover theme variable", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
136
|
+
yield initTestBed(`<ColorPicker />`, {
|
|
137
|
+
testThemeVars: {
|
|
138
|
+
"borderColor-ColorPicker": "rgb(0, 0, 0)",
|
|
139
|
+
"borderColor-ColorPicker--hover": "rgb(255, 0, 0)",
|
|
140
|
+
},
|
|
141
|
+
});
|
|
142
|
+
const colorInput = page.locator("input[type='color']");
|
|
143
|
+
yield (0, fixtures_1.expect)(colorInput).toHaveCSS("border-color", "rgb(0, 0, 0)");
|
|
144
|
+
yield colorInput.hover();
|
|
145
|
+
yield (0, fixtures_1.expect)(colorInput).toHaveCSS("border-color", "rgb(255, 0, 0)");
|
|
146
|
+
}));
|
|
147
|
+
(0, fixtures_1.test)("component applies borderColor-ColorPicker--focus theme variable", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
148
|
+
yield initTestBed(`<ColorPicker />`, {
|
|
149
|
+
testThemeVars: {
|
|
150
|
+
"borderColor-ColorPicker": "rgb(0, 0, 0)",
|
|
151
|
+
"borderColor-ColorPicker--focus": "rgb(0, 255, 0)",
|
|
152
|
+
},
|
|
153
|
+
});
|
|
154
|
+
const colorInput = page.locator("input[type='color']");
|
|
155
|
+
yield (0, fixtures_1.expect)(colorInput).toHaveCSS("border-color", "rgb(0, 0, 0)");
|
|
156
|
+
yield colorInput.focus();
|
|
157
|
+
yield (0, fixtures_1.expect)(colorInput).toHaveCSS("border-color", "rgb(0, 255, 0)");
|
|
158
|
+
}));
|
|
159
|
+
(0, fixtures_1.test)("component applies borderRadius-ColorPicker theme variable", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
160
|
+
yield initTestBed(`<ColorPicker />`, {
|
|
161
|
+
testThemeVars: {
|
|
162
|
+
"borderRadius-ColorPicker": "4px",
|
|
163
|
+
},
|
|
164
|
+
});
|
|
165
|
+
const colorInput = page.locator("input[type='color']");
|
|
166
|
+
yield (0, fixtures_1.expect)(colorInput).toHaveCSS("border-radius", "4px");
|
|
167
|
+
}));
|
|
168
|
+
(0, fixtures_1.test)("component applies borderWidth-ColorPicker theme variable", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
169
|
+
yield initTestBed(`<ColorPicker />`, {
|
|
170
|
+
testThemeVars: {
|
|
171
|
+
"borderWidth-ColorPicker": "2px",
|
|
172
|
+
},
|
|
173
|
+
});
|
|
174
|
+
const colorInput = page.locator("input[type='color']");
|
|
175
|
+
yield (0, fixtures_1.expect)(colorInput).toHaveCSS("border-width", "2px");
|
|
176
|
+
}));
|
|
177
|
+
(0, fixtures_1.test)("component applies borderStyle-ColorPicker theme variable", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
178
|
+
yield initTestBed(`<ColorPicker />`, {
|
|
179
|
+
testThemeVars: {
|
|
180
|
+
"borderStyle-ColorPicker": "solid",
|
|
181
|
+
},
|
|
182
|
+
});
|
|
183
|
+
const colorInput = page.locator("input[type='color']");
|
|
184
|
+
yield (0, fixtures_1.expect)(colorInput).toHaveCSS("border-style", "solid");
|
|
185
|
+
}));
|
|
186
|
+
(0, fixtures_1.test)("component applies boxShadow-ColorPicker theme variable", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
187
|
+
yield initTestBed(`<ColorPicker />`, {
|
|
188
|
+
testThemeVars: {
|
|
189
|
+
"boxShadow-ColorPicker": "0 2px 4px rgba(0, 0, 0, 0.1)",
|
|
190
|
+
},
|
|
191
|
+
});
|
|
192
|
+
const colorInput = page.locator("input[type='color']");
|
|
193
|
+
yield (0, fixtures_1.expect)(colorInput).toHaveCSS("box-shadow", "rgba(0, 0, 0, 0.1) 0px 2px 4px 0px");
|
|
194
|
+
}));
|
|
195
|
+
// =============================================================================
|
|
196
|
+
// EDGE CASE TESTS
|
|
197
|
+
// =============================================================================
|
|
198
|
+
(0, fixtures_1.test)("component handles invalid color values gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
199
|
+
yield initTestBed(`<ColorPicker initialValue="not-a-color" />`);
|
|
200
|
+
const colorInput = page.locator("input[type='color']");
|
|
201
|
+
yield (0, fixtures_1.expect)(colorInput).toHaveValue("#000000");
|
|
202
|
+
}));
|
|
203
|
+
(0, fixtures_1.test)("component handles required attribute correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
204
|
+
yield initTestBed(`<ColorPicker required="true" />`);
|
|
205
|
+
const colorInput = page.locator("input[type='color']");
|
|
206
|
+
yield (0, fixtures_1.expect)(colorInput).toHaveAttribute("required", "");
|
|
207
|
+
}));
|
|
208
|
+
(0, fixtures_1.test)("component handles readOnly mode correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
209
|
+
yield initTestBed(`<ColorPicker readOnly="true" />`);
|
|
210
|
+
const colorInput = page.locator("input[type='color']");
|
|
211
|
+
// For ColorPickers the readOnly attribute typically makes the input disabled
|
|
212
|
+
yield (0, fixtures_1.expect)(colorInput).toBeDisabled();
|
|
213
|
+
}));
|
|
214
|
+
// =============================================================================
|
|
215
|
+
// PERFORMANCE TESTS
|
|
216
|
+
// =============================================================================
|
|
217
|
+
(0, fixtures_1.test)("component handles rapid value changes efficiently", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
218
|
+
// Test with initial color
|
|
219
|
+
yield initTestBed(`
|
|
220
|
+
<Fragment>
|
|
221
|
+
<ColorPicker id="colorPicker" initialValue="#ff0000" />
|
|
222
|
+
<Button testId="toGreen" onClick="colorPicker.setValue('#00ff00')">Change to Green</Button>
|
|
223
|
+
<Button testId="toBlue" onClick="colorPicker.setValue('#0000ff')">Change to Blue</Button>
|
|
224
|
+
</Fragment>
|
|
225
|
+
`);
|
|
226
|
+
yield page.getByTestId("toGreen").click();
|
|
227
|
+
yield page.getByTestId("toBlue").click();
|
|
228
|
+
yield (0, fixtures_1.expect)(page.locator("input[type='color']")).toHaveValue("#0000ff", { timeout: 3000 });
|
|
229
|
+
}));
|
|
230
|
+
// =============================================================================
|
|
231
|
+
// INTEGRATION TESTS
|
|
232
|
+
// =============================================================================
|
|
233
|
+
(0, fixtures_1.test)("component works correctly in a form context", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
234
|
+
const { testStateDriver } = yield initTestBed(`
|
|
235
|
+
<Form onSubmit="(data) => testState = data.testField" data="{{ testField: '#0000ff' }}">
|
|
236
|
+
<FormItem type="colorpicker" label="Choose Color" bindTo="testField" />
|
|
237
|
+
</Form>
|
|
238
|
+
`);
|
|
239
|
+
// Check that the color picker is inside the form
|
|
240
|
+
const formElement = page.locator("form");
|
|
241
|
+
const colorInput = formElement.locator("input[type='color']");
|
|
242
|
+
yield (0, fixtures_1.expect)(colorInput).toBeVisible();
|
|
243
|
+
// Submit the form
|
|
244
|
+
yield page.locator("[type=submit]").click();
|
|
245
|
+
// Check that the form was submitted
|
|
246
|
+
yield fixtures_1.expect.poll(testStateDriver.testState).toEqual("#0000ff");
|
|
247
|
+
}));
|
|
248
|
+
(0, fixtures_1.test)("component value API works", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
249
|
+
yield initTestBed(`
|
|
250
|
+
<Fragment>
|
|
251
|
+
<ColorPicker id="colorPicker" initialValue="#ff0000" />
|
|
252
|
+
<Text testId="colorPickerValue" value="{colorPicker.value}" />
|
|
253
|
+
</Fragment>
|
|
254
|
+
`);
|
|
255
|
+
yield (0, fixtures_1.expect)(page.getByTestId("colorPickerValue")).toHaveText("#ff0000");
|
|
256
|
+
}));
|
|
257
|
+
(0, fixtures_1.test)("component setValue API works", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
258
|
+
yield initTestBed(`
|
|
259
|
+
<Fragment>
|
|
260
|
+
<ColorPicker id="colorPicker" initialValue="#ff0000" />
|
|
261
|
+
<Button onClick="colorPicker.setValue('#00ff00')">Change Color</Button>
|
|
262
|
+
</Fragment>
|
|
263
|
+
`);
|
|
264
|
+
// Test setValue API
|
|
265
|
+
yield page.getByRole("button", { name: "Change Color" }).click();
|
|
266
|
+
const colorInput = page.locator("input[type='color']");
|
|
267
|
+
yield (0, fixtures_1.expect)(colorInput).toHaveValue("#00ff00");
|
|
268
|
+
}));
|
|
269
|
+
(0, fixtures_1.test)("component focus API works", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
270
|
+
const { testStateDriver } = yield initTestBed(`
|
|
271
|
+
<Fragment>
|
|
272
|
+
<ColorPicker id="colorPicker" onGotFocus="testState = 'focused'" />
|
|
273
|
+
<Button onClick="colorPicker.focus()">Focus Color Picker</Button>
|
|
274
|
+
</Fragment>
|
|
275
|
+
`);
|
|
276
|
+
const button = page.getByRole("button", { name: "Focus Color Picker" });
|
|
277
|
+
// Focus the input
|
|
278
|
+
yield button.click();
|
|
279
|
+
// Verify the input is focused
|
|
280
|
+
yield (0, fixtures_1.expect)(page.locator("input[type='color']")).toBeFocused();
|
|
281
|
+
// Verify the focus event fired
|
|
282
|
+
yield fixtures_1.expect.poll(testStateDriver.testState).toEqual("focused");
|
|
283
|
+
}));
|
|
@@ -30,15 +30,26 @@ exports.defaultProps = {
|
|
|
30
30
|
validationStatus: "none",
|
|
31
31
|
};
|
|
32
32
|
exports.ColorPicker = (0, react_2.forwardRef)((_a, forwardedRef) => {
|
|
33
|
-
var { style, className, updateState, onDidChange = constants_1.noop, onFocus = constants_1.noop, onBlur = constants_1.noop, registerComponentApi, enabled = exports.defaultProps.enabled, value = exports.defaultProps.value, autoFocus, tabIndex =
|
|
33
|
+
var { style, className, updateState, onDidChange = constants_1.noop, onFocus = constants_1.noop, onBlur = constants_1.noop, registerComponentApi, enabled = exports.defaultProps.enabled, readOnly, value = exports.defaultProps.value, autoFocus, tabIndex = 0, label, labelPosition, labelWidth, labelBreak, required, validationStatus = exports.defaultProps.validationStatus, initialValue = exports.defaultProps.initialValue } = _a, rest = __rest(_a, ["style", "className", "updateState", "onDidChange", "onFocus", "onBlur", "registerComponentApi", "enabled", "readOnly", "value", "autoFocus", "tabIndex", "label", "labelPosition", "labelWidth", "labelBreak", "required", "validationStatus", "initialValue"]);
|
|
34
34
|
const inputRef = (0, react_2.useRef)(null);
|
|
35
|
+
const [isPending, startTransition] = (0, react_1.useTransition)();
|
|
35
36
|
const updateValue = (0, react_2.useCallback)((value) => {
|
|
36
37
|
updateState({ value });
|
|
37
38
|
onDidChange(value);
|
|
38
39
|
}, [onDidChange, updateState]);
|
|
40
|
+
const updateValueWithTransition = (0, react_2.useCallback)((value, immediate = false) => {
|
|
41
|
+
if (immediate) {
|
|
42
|
+
updateValue(value);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
startTransition(() => {
|
|
46
|
+
updateValue(value);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}, [updateValue, startTransition]);
|
|
39
50
|
const onInputChange = (0, react_2.useCallback)((event) => {
|
|
40
|
-
|
|
41
|
-
}, [
|
|
51
|
+
updateValueWithTransition(event.target.value);
|
|
52
|
+
}, [updateValueWithTransition]);
|
|
42
53
|
(0, react_1.useEffect)(() => {
|
|
43
54
|
updateState({ value: initialValue }, { initial: true });
|
|
44
55
|
}, [initialValue, updateState]);
|
|
@@ -54,7 +65,7 @@ exports.ColorPicker = (0, react_2.forwardRef)((_a, forwardedRef) => {
|
|
|
54
65
|
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
55
66
|
}, []);
|
|
56
67
|
const setValue = (0, misc_1.useEvent)((newValue) => {
|
|
57
|
-
|
|
68
|
+
updateValueWithTransition(newValue, true); // Immediate update for programmatic changes
|
|
58
69
|
});
|
|
59
70
|
(0, react_1.useEffect)(() => {
|
|
60
71
|
registerComponentApi === null || registerComponentApi === void 0 ? void 0 : registerComponentApi({
|
|
@@ -67,6 +78,6 @@ exports.ColorPicker = (0, react_2.forwardRef)((_a, forwardedRef) => {
|
|
|
67
78
|
[ColorPicker_module_scss_1.default.error]: validationStatus === "error",
|
|
68
79
|
[ColorPicker_module_scss_1.default.warning]: validationStatus === "warning",
|
|
69
80
|
[ColorPicker_module_scss_1.default.valid]: validationStatus === "valid",
|
|
70
|
-
}), disabled: !enabled, onFocus: handleOnFocus, onChange: onInputChange, autoFocus: autoFocus, onBlur: handleOnBlur, required: required, type: "color", inputMode: "text", ref: inputRef, value: value
|
|
81
|
+
}), disabled: !enabled, onFocus: handleOnFocus, onChange: onInputChange, readOnly: readOnly, autoFocus: autoFocus, tabIndex: tabIndex, onBlur: handleOnBlur, required: required, type: "color", inputMode: "text", ref: inputRef, value: value }) })));
|
|
71
82
|
});
|
|
72
83
|
exports.ColorPicker.displayName = "ColorPicker";
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const data = [
|
|
4
|
+
{
|
|
5
|
+
id: 0,
|
|
6
|
+
name: "Apples",
|
|
7
|
+
quantity: 5,
|
|
8
|
+
unit: "pieces",
|
|
9
|
+
category: "fruits",
|
|
10
|
+
key: 5,
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
id: 1,
|
|
14
|
+
name: "Bananas",
|
|
15
|
+
quantity: 6,
|
|
16
|
+
unit: "pieces",
|
|
17
|
+
category: "fruits",
|
|
18
|
+
key: 4,
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
id: 2,
|
|
22
|
+
name: "Carrots",
|
|
23
|
+
quantity: 100,
|
|
24
|
+
unit: "grams",
|
|
25
|
+
category: "vegetables",
|
|
26
|
+
key: 3,
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
id: 3,
|
|
30
|
+
name: "Spinach",
|
|
31
|
+
quantity: 1,
|
|
32
|
+
unit: "bunch",
|
|
33
|
+
category: "vegetables",
|
|
34
|
+
key: 2,
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
id: 4,
|
|
38
|
+
name: "Milk",
|
|
39
|
+
quantity: 10,
|
|
40
|
+
unit: "liter",
|
|
41
|
+
category: "dairy",
|
|
42
|
+
key: 1,
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
id: 5,
|
|
46
|
+
name: "Cheese",
|
|
47
|
+
quantity: 200,
|
|
48
|
+
unit: "grams",
|
|
49
|
+
category: "dairy",
|
|
50
|
+
key: 0,
|
|
51
|
+
},
|
|
52
|
+
];
|
|
53
|
+
exports.default = data;
|
|
@@ -102,7 +102,6 @@ const AutoComplete_1 = require("./AutoComplete/AutoComplete");
|
|
|
102
102
|
const Backdrop_1 = require("./Backdrop/Backdrop");
|
|
103
103
|
const HtmlTags_1 = require("./HtmlTags/HtmlTags");
|
|
104
104
|
const ColorPicker_1 = require("./ColorPicker/ColorPicker");
|
|
105
|
-
const RadioItem_1 = require("./RadioGroup/RadioItem");
|
|
106
105
|
const InspectButton_1 = require("./InspectButton/InspectButton");
|
|
107
106
|
const NestedApp_1 = require("./NestedApp/NestedApp");
|
|
108
107
|
const AppWithCodeView_1 = require("./NestedApp/AppWithCodeView");
|
|
@@ -166,9 +165,13 @@ class ComponentRegistry {
|
|
|
166
165
|
var _a;
|
|
167
166
|
(_a = extension.components) === null || _a === void 0 ? void 0 : _a.forEach((c) => {
|
|
168
167
|
if ("type" in c) {
|
|
169
|
-
//
|
|
168
|
+
// --- This is a regular component
|
|
170
169
|
this.registerComponentRenderer(c, extension.namespace);
|
|
171
170
|
}
|
|
171
|
+
else if ("compoundComponentDef" in c) {
|
|
172
|
+
// --- This is a user defined component
|
|
173
|
+
this.registerCompoundComponentRenderer(c, extension.namespace);
|
|
174
|
+
}
|
|
172
175
|
});
|
|
173
176
|
};
|
|
174
177
|
// --- Registers a renderable component using its renderer function
|
|
@@ -350,9 +353,6 @@ class ComponentRegistry {
|
|
|
350
353
|
if (process.env.VITE_USED_COMPONENTS_CarouselItem !== "false") {
|
|
351
354
|
this.registerCoreComponent(CarouselItem_1.carouselItemComponentRenderer);
|
|
352
355
|
}
|
|
353
|
-
if (process.env.VITE_USED_COMPONENTS_RadioItem !== "false") {
|
|
354
|
-
this.registerCoreComponent(RadioItem_1.radioItemComponentRenderer);
|
|
355
|
-
}
|
|
356
356
|
if (process.env.VITE_USED_COMPONENTS_FileUploadDropZone !== "false") {
|
|
357
357
|
this.registerCoreComponent(FileUploadDropZone_1.fileUploadDropZoneComponentRenderer);
|
|
358
358
|
}
|
|
@@ -748,7 +748,7 @@ class ComponentRegistry {
|
|
|
748
748
|
const component = {
|
|
749
749
|
type: compoundComponentDef.name,
|
|
750
750
|
renderer: (rendererContext) => {
|
|
751
|
-
return ((0, jsx_runtime_1.jsx)(CompoundComponent_1.CompoundComponent, Object.assign({ api: compoundComponentDef.api, scriptCollected: compoundComponentDef.scriptCollected, compound: compoundComponentDef.component }, rendererContext)));
|
|
751
|
+
return ((0, jsx_runtime_1.jsx)(CompoundComponent_1.CompoundComponent, Object.assign({ api: compoundComponentDef.api, scriptCollected: compoundComponentDef.component.scriptCollected, compound: compoundComponentDef.component }, rendererContext)));
|
|
752
752
|
},
|
|
753
753
|
isCompoundComponent: true,
|
|
754
754
|
metadata,
|