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,479 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const component_test_helpers_1 = require("../../testing/component-test-helpers");
|
|
13
|
+
const fixtures_1 = require("../../testing/fixtures");
|
|
14
|
+
// =============================================================================
|
|
15
|
+
// BASIC FUNCTIONALITY TESTS
|
|
16
|
+
// =============================================================================
|
|
17
|
+
fixtures_1.test.describe("Basic Functionality", () => {
|
|
18
|
+
(0, fixtures_1.test)("RadioGroup with Option elements as children", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
19
|
+
yield initTestBed(`
|
|
20
|
+
<RadioGroup>
|
|
21
|
+
<Option value="1"></Option>
|
|
22
|
+
<Option value="2"></Option>
|
|
23
|
+
<Option value="3"></Option>
|
|
24
|
+
</RadioGroup>
|
|
25
|
+
`);
|
|
26
|
+
const options = page.getByRole("radiogroup").getByRole("radio");
|
|
27
|
+
yield (0, fixtures_1.expect)(options).toHaveCount(3);
|
|
28
|
+
}));
|
|
29
|
+
(0, fixtures_1.test)("RadioGroup with Option elements with labels as children", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
30
|
+
yield initTestBed(`
|
|
31
|
+
<RadioGroup>
|
|
32
|
+
<Option value="1">Option 1</Option>
|
|
33
|
+
<Option value="2">Option 2</Option>
|
|
34
|
+
<Option value="3">Option 3</Option>
|
|
35
|
+
</RadioGroup>
|
|
36
|
+
`);
|
|
37
|
+
const optionLabels = page.getByRole("radiogroup").locator("label");
|
|
38
|
+
yield (0, fixtures_1.expect)(optionLabels).toHaveCount(3);
|
|
39
|
+
yield (0, fixtures_1.expect)(optionLabels.nth(0)).toHaveText("Option 1");
|
|
40
|
+
yield (0, fixtures_1.expect)(optionLabels.nth(1)).toHaveText("Option 2");
|
|
41
|
+
yield (0, fixtures_1.expect)(optionLabels.nth(2)).toHaveText("Option 3");
|
|
42
|
+
}));
|
|
43
|
+
(0, fixtures_1.test)("Providing non-Option elements as children still renders", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
44
|
+
yield initTestBed(`
|
|
45
|
+
<RadioGroup>
|
|
46
|
+
<Text>Not an Option</Text>
|
|
47
|
+
</RadioGroup>
|
|
48
|
+
`);
|
|
49
|
+
yield (0, fixtures_1.expect)(page.getByRole("radiogroup")).toBeVisible();
|
|
50
|
+
yield (0, fixtures_1.expect)(page.getByText("Not an Option")).toBeVisible();
|
|
51
|
+
}));
|
|
52
|
+
(0, fixtures_1.test)("Mixing Option and non-Option elements as children renders all", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, }) {
|
|
53
|
+
yield initTestBed(`
|
|
54
|
+
<RadioGroup>
|
|
55
|
+
<Text>Not an Option</Text>
|
|
56
|
+
<Option value="1">Option 1</Option>
|
|
57
|
+
</RadioGroup>
|
|
58
|
+
`);
|
|
59
|
+
yield (0, fixtures_1.expect)(page.getByRole("radiogroup")).toBeVisible();
|
|
60
|
+
yield (0, fixtures_1.expect)(page.getByText("Not an Option")).toBeVisible();
|
|
61
|
+
yield (0, fixtures_1.expect)(page.getByText("Option 1")).toBeVisible();
|
|
62
|
+
}));
|
|
63
|
+
(0, fixtures_1.test)("autoFocus sets focus on the first Option on page load", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
64
|
+
yield initTestBed(`
|
|
65
|
+
<RadioGroup autoFocus="true">
|
|
66
|
+
<Option value="1">Option 1</Option>
|
|
67
|
+
</RadioGroup>
|
|
68
|
+
`);
|
|
69
|
+
yield (0, fixtures_1.expect)(page.getByRole("radiogroup").getByRole("radio")).toBeFocused();
|
|
70
|
+
}));
|
|
71
|
+
(0, fixtures_1.test)("field is marked as required in the DOM when required=true", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, }) {
|
|
72
|
+
yield initTestBed(`
|
|
73
|
+
<RadioGroup required="true">
|
|
74
|
+
<Option value="1">Option 1</Option>
|
|
75
|
+
</RadioGroup>
|
|
76
|
+
`);
|
|
77
|
+
yield (0, fixtures_1.expect)(page.getByRole("radiogroup")).toHaveAttribute("aria-required");
|
|
78
|
+
}));
|
|
79
|
+
(0, fixtures_1.test)("making field required shows a visual indicator", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
80
|
+
yield initTestBed(`
|
|
81
|
+
<RadioGroup required="true" label="Radio Group Label">
|
|
82
|
+
<Option value="1">Option 1</Option>
|
|
83
|
+
</RadioGroup>
|
|
84
|
+
`);
|
|
85
|
+
yield (0, fixtures_1.expect)(page.getByText("*")).toBeVisible();
|
|
86
|
+
}));
|
|
87
|
+
(0, fixtures_1.test)("initialValue sets the initial selected option (string initialValue & options)", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, }) {
|
|
88
|
+
yield initTestBed(`
|
|
89
|
+
<RadioGroup initialValue="2">
|
|
90
|
+
<Option value="1">Option 1</Option>
|
|
91
|
+
<Option value="2">Option 2</Option>
|
|
92
|
+
<Option value="3">Option 3</Option>
|
|
93
|
+
</RadioGroup>
|
|
94
|
+
`);
|
|
95
|
+
const options = page.getByRole("radiogroup").getByRole("radio");
|
|
96
|
+
yield (0, fixtures_1.expect)(options.nth(0)).not.toBeChecked();
|
|
97
|
+
yield (0, fixtures_1.expect)(options.nth(1)).toBeChecked();
|
|
98
|
+
yield (0, fixtures_1.expect)(options.nth(2)).not.toBeChecked();
|
|
99
|
+
}));
|
|
100
|
+
(0, fixtures_1.test)("initialValue sets the initial selected option (number initialValue & options)", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, }) {
|
|
101
|
+
yield initTestBed(`
|
|
102
|
+
<RadioGroup initialValue="{2}">
|
|
103
|
+
<Option value="{1}">Option 1</Option>
|
|
104
|
+
<Option value="{2}">Option 2</Option>
|
|
105
|
+
<Option value="{3}">Option 3</Option>
|
|
106
|
+
</RadioGroup>
|
|
107
|
+
`);
|
|
108
|
+
const options = page.getByRole("radiogroup").getByRole("radio");
|
|
109
|
+
yield (0, fixtures_1.expect)(options.nth(0)).not.toBeChecked();
|
|
110
|
+
yield (0, fixtures_1.expect)(options.nth(1)).toBeChecked();
|
|
111
|
+
yield (0, fixtures_1.expect)(options.nth(2)).not.toBeChecked();
|
|
112
|
+
}));
|
|
113
|
+
(0, fixtures_1.test)("initialValue does not set the initial selected option (number initialValue, string options)", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, }) {
|
|
114
|
+
yield initTestBed(`
|
|
115
|
+
<RadioGroup initialValue="{2}">
|
|
116
|
+
<Option value="1">Option 1</Option>
|
|
117
|
+
<Option value="2">Option 2</Option>
|
|
118
|
+
<Option value="3">Option 3</Option>
|
|
119
|
+
</RadioGroup>
|
|
120
|
+
`);
|
|
121
|
+
const options = page.getByRole("radiogroup").getByRole("radio");
|
|
122
|
+
yield (0, fixtures_1.expect)(options.nth(0)).not.toBeChecked();
|
|
123
|
+
yield (0, fixtures_1.expect)(options.nth(1)).not.toBeChecked();
|
|
124
|
+
yield (0, fixtures_1.expect)(options.nth(2)).not.toBeChecked();
|
|
125
|
+
}));
|
|
126
|
+
(0, fixtures_1.test)("initialValue does not set the initial selected option (string initialValue, number options)", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, }) {
|
|
127
|
+
yield initTestBed(`
|
|
128
|
+
<RadioGroup initialValue="2">
|
|
129
|
+
<Option value="{1}">Option 1</Option>
|
|
130
|
+
<Option value="{2}">Option 2</Option>
|
|
131
|
+
<Option value="{3}">Option 3</Option>
|
|
132
|
+
</RadioGroup>
|
|
133
|
+
`);
|
|
134
|
+
const options = page.getByRole("radiogroup").getByRole("radio");
|
|
135
|
+
yield (0, fixtures_1.expect)(options.nth(0)).not.toBeChecked();
|
|
136
|
+
yield (0, fixtures_1.expect)(options.nth(1)).not.toBeChecked();
|
|
137
|
+
yield (0, fixtures_1.expect)(options.nth(2)).not.toBeChecked();
|
|
138
|
+
}));
|
|
139
|
+
(0, fixtures_1.test)("initialValue sets the initial selected option (boolean initialValue & options)", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, }) {
|
|
140
|
+
yield initTestBed(`
|
|
141
|
+
<RadioGroup initialValue="{true}">
|
|
142
|
+
<Option value="{true}">Option 1</Option>
|
|
143
|
+
<Option value="{false}">Option 2</Option>
|
|
144
|
+
</RadioGroup>
|
|
145
|
+
`);
|
|
146
|
+
const options = page.getByRole("radiogroup").getByRole("radio");
|
|
147
|
+
yield (0, fixtures_1.expect)(options.nth(0)).toBeChecked();
|
|
148
|
+
yield (0, fixtures_1.expect)(options.nth(1)).not.toBeChecked();
|
|
149
|
+
}));
|
|
150
|
+
(0, fixtures_1.test)("initialValue does not set the initial selected option (boolean initialValue, string options)", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, }) {
|
|
151
|
+
yield initTestBed(`
|
|
152
|
+
<RadioGroup initialValue="{true}">
|
|
153
|
+
<Option value="true">Option 1</Option>
|
|
154
|
+
<Option value="false">Option 2</Option>
|
|
155
|
+
</RadioGroup>
|
|
156
|
+
`);
|
|
157
|
+
const options = page.getByRole("radiogroup").getByRole("radio");
|
|
158
|
+
yield (0, fixtures_1.expect)(options.nth(0)).not.toBeChecked();
|
|
159
|
+
yield (0, fixtures_1.expect)(options.nth(1)).not.toBeChecked();
|
|
160
|
+
}));
|
|
161
|
+
(0, fixtures_1.test)("initialValue does not set the initial selected option (string initialValue, boolean options)", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, }) {
|
|
162
|
+
yield initTestBed(`
|
|
163
|
+
<RadioGroup initialValue="true">
|
|
164
|
+
<Option value="{true}">Option 1</Option>
|
|
165
|
+
<Option value="{false}">Option 2</Option>
|
|
166
|
+
</RadioGroup>
|
|
167
|
+
`);
|
|
168
|
+
const options = page.getByRole("radiogroup").getByRole("radio");
|
|
169
|
+
yield (0, fixtures_1.expect)(options.nth(0)).not.toBeChecked();
|
|
170
|
+
yield (0, fixtures_1.expect)(options.nth(1)).not.toBeChecked();
|
|
171
|
+
}));
|
|
172
|
+
(0, fixtures_1.test)("undefined does not render Radio Option", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
173
|
+
yield initTestBed(`
|
|
174
|
+
<RadioGroup>
|
|
175
|
+
<Option value="1">Option 1</Option>
|
|
176
|
+
<Option value="{undefined}">Option 2</Option>
|
|
177
|
+
</RadioGroup>
|
|
178
|
+
`);
|
|
179
|
+
const optionLabels = page.getByRole("radiogroup").locator("label");
|
|
180
|
+
yield (0, fixtures_1.expect)(optionLabels).toHaveCount(1);
|
|
181
|
+
yield (0, fixtures_1.expect)(optionLabels.first()).toHaveText("Option 1");
|
|
182
|
+
}));
|
|
183
|
+
(0, fixtures_1.test)("null renders Radio Option", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
184
|
+
yield initTestBed(`
|
|
185
|
+
<RadioGroup>
|
|
186
|
+
<Option value="1">Option 1</Option>
|
|
187
|
+
<Option value="{null}">Option 2</Option>
|
|
188
|
+
</RadioGroup>
|
|
189
|
+
`);
|
|
190
|
+
const optionLabels = page.getByRole("radiogroup").locator("label");
|
|
191
|
+
yield (0, fixtures_1.expect)(optionLabels).toHaveCount(2);
|
|
192
|
+
yield (0, fixtures_1.expect)(optionLabels.first()).toHaveText("Option 1");
|
|
193
|
+
yield (0, fixtures_1.expect)(optionLabels.nth(1)).toHaveText("Option 2");
|
|
194
|
+
}));
|
|
195
|
+
[
|
|
196
|
+
{ label: "empty object", value: "{}" },
|
|
197
|
+
{ label: "object", value: "{ a: 1 }" },
|
|
198
|
+
{ label: "function", value: "() => {}" },
|
|
199
|
+
{ label: "NaN", value: "NaN" },
|
|
200
|
+
].forEach(({ label, value }) => {
|
|
201
|
+
(0, fixtures_1.test)(`initialValue=${label} falls back to default (empty string)`, (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, }) {
|
|
202
|
+
yield initTestBed(`
|
|
203
|
+
<RadioGroup initialValue="{${value}}">
|
|
204
|
+
<Option value="{${value}}">Option 1</Option>
|
|
205
|
+
<Option value="2">Option 2</Option>
|
|
206
|
+
</RadioGroup>
|
|
207
|
+
`);
|
|
208
|
+
const options = page.getByRole("radiogroup").getByRole("radio");
|
|
209
|
+
yield (0, fixtures_1.expect)(options.nth(0)).not.toBeChecked();
|
|
210
|
+
yield (0, fixtures_1.expect)(options.nth(1)).not.toBeChecked();
|
|
211
|
+
}));
|
|
212
|
+
});
|
|
213
|
+
(0, fixtures_1.test)("readOnly disables switching between options", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
214
|
+
yield initTestBed(`
|
|
215
|
+
<RadioGroup initialValue="1" readOnly="true">
|
|
216
|
+
<Option value="1">Option 1</Option>
|
|
217
|
+
<Option value="2">Option 2</Option>
|
|
218
|
+
</RadioGroup>
|
|
219
|
+
`);
|
|
220
|
+
const options = page.getByRole("radiogroup").getByRole("radio");
|
|
221
|
+
yield (0, fixtures_1.expect)(options.nth(0)).toBeChecked();
|
|
222
|
+
yield options.nth(1).click();
|
|
223
|
+
yield (0, fixtures_1.expect)(options.nth(0)).toBeChecked();
|
|
224
|
+
yield (0, fixtures_1.expect)(options.nth(1)).not.toBeChecked();
|
|
225
|
+
}));
|
|
226
|
+
(0, fixtures_1.test)("enabled input field allows user interaction for field", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
227
|
+
yield initTestBed(`
|
|
228
|
+
<RadioGroup initialValue="1" enabled="true">
|
|
229
|
+
<Option value="1">Option 1</Option>
|
|
230
|
+
<Option value="2">Option 2</Option>
|
|
231
|
+
</RadioGroup>
|
|
232
|
+
`);
|
|
233
|
+
const radios = yield page.getByRole("radiogroup").getByRole("radio").all();
|
|
234
|
+
for (const radio of radios) {
|
|
235
|
+
yield (0, fixtures_1.expect)(radio).toBeEnabled();
|
|
236
|
+
}
|
|
237
|
+
}));
|
|
238
|
+
(0, fixtures_1.test)("disabled input field stops user interaction for field", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
239
|
+
yield initTestBed(`
|
|
240
|
+
<RadioGroup initialValue="1" enabled="false">
|
|
241
|
+
<Option value="1">Option 1</Option>
|
|
242
|
+
<Option value="2">Option 2</Option>
|
|
243
|
+
</RadioGroup>
|
|
244
|
+
`);
|
|
245
|
+
const radios = yield page.getByRole("radiogroup").getByRole("radio").all();
|
|
246
|
+
for (const radio of radios) {
|
|
247
|
+
yield (0, fixtures_1.expect)(radio).toBeDisabled();
|
|
248
|
+
}
|
|
249
|
+
}));
|
|
250
|
+
(0, fixtures_1.test)("disabled option does not disable field", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
251
|
+
yield initTestBed(`
|
|
252
|
+
<RadioGroup initialValue="1">
|
|
253
|
+
<Option value="1" enabled="false">Option 1</Option>
|
|
254
|
+
<Option value="2">Option 2</Option>
|
|
255
|
+
</RadioGroup>
|
|
256
|
+
`);
|
|
257
|
+
const options = page.getByRole("radiogroup").getByRole("radio");
|
|
258
|
+
yield (0, fixtures_1.expect)(options.nth(0)).toBeDisabled();
|
|
259
|
+
yield (0, fixtures_1.expect)(options.nth(1)).toBeEnabled();
|
|
260
|
+
}));
|
|
261
|
+
(0, fixtures_1.test)("onDidChange is called on input change", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
262
|
+
const { testStateDriver } = yield initTestBed(`
|
|
263
|
+
<RadioGroup initialValue="1" onDidChange="(value) => testState = value">
|
|
264
|
+
<Option value="1">Option 1</Option>
|
|
265
|
+
<Option value="2">Option 2</Option>
|
|
266
|
+
</RadioGroup>
|
|
267
|
+
`);
|
|
268
|
+
const options = page.getByRole("radiogroup").getByRole("radio");
|
|
269
|
+
yield options.nth(1).click();
|
|
270
|
+
yield fixtures_1.expect.poll(testStateDriver.testState).toBe("2");
|
|
271
|
+
}));
|
|
272
|
+
(0, fixtures_1.test)("onDidChange is not called if field is disabled", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
273
|
+
const { testStateDriver } = yield initTestBed(`
|
|
274
|
+
<RadioGroup enabled="false" initialValue="1" onDidChange="(value) => testState = value">
|
|
275
|
+
<Option value="1">Option 1</Option>
|
|
276
|
+
<Option value="2">Option 2</Option>
|
|
277
|
+
</RadioGroup>
|
|
278
|
+
`);
|
|
279
|
+
const options = page.getByRole("radiogroup").getByRole("radio");
|
|
280
|
+
// Verify the radio buttons are disabled
|
|
281
|
+
yield (0, fixtures_1.expect)(options.nth(1)).toBeDisabled();
|
|
282
|
+
yield options.nth(1).click({ force: true });
|
|
283
|
+
// Verify the state hasn't changed (should still be null since no change handler was called)
|
|
284
|
+
yield fixtures_1.expect.poll(testStateDriver.testState).toBe(null);
|
|
285
|
+
}));
|
|
286
|
+
(0, fixtures_1.test)("gotFocus event fires on focusing the field", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
287
|
+
const { testStateDriver } = yield initTestBed(`
|
|
288
|
+
<RadioGroup initialValue="1" onGotFocus="() => testState = 'focused'">
|
|
289
|
+
<Option value="1">Option 1</Option>
|
|
290
|
+
</RadioGroup>
|
|
291
|
+
`);
|
|
292
|
+
const options = page.getByRole("radiogroup").getByRole("radio");
|
|
293
|
+
yield options.nth(0).focus();
|
|
294
|
+
yield fixtures_1.expect.poll(testStateDriver.testState).toBe("focused");
|
|
295
|
+
}));
|
|
296
|
+
(0, fixtures_1.test)("lostFocus event fires on blurring the field", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
297
|
+
const { testStateDriver } = yield initTestBed(`
|
|
298
|
+
<RadioGroup initialValue="1" onLostFocus="() => testState = 'blurred'">
|
|
299
|
+
<Option value="1">Option 1</Option>
|
|
300
|
+
</RadioGroup>
|
|
301
|
+
`);
|
|
302
|
+
const options = page.getByRole("radiogroup").getByRole("radio");
|
|
303
|
+
yield options.nth(0).focus();
|
|
304
|
+
yield options.nth(0).blur();
|
|
305
|
+
yield fixtures_1.expect.poll(testStateDriver.testState).toBe("blurred");
|
|
306
|
+
}));
|
|
307
|
+
});
|
|
308
|
+
(0, fixtures_1.test)("validationStatus 'none' is applied correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
309
|
+
yield initTestBed(`
|
|
310
|
+
<RadioGroup validationStatus="none" initialValue="1">
|
|
311
|
+
<Option value="1">Option 1</Option>
|
|
312
|
+
<Option value="2">Option 2</Option>
|
|
313
|
+
</RadioGroup>
|
|
314
|
+
|
|
315
|
+
`, {
|
|
316
|
+
testThemeVars: {
|
|
317
|
+
"borderColor-checked-RadioGroupOption": "rgb(80, 80, 80)",
|
|
318
|
+
},
|
|
319
|
+
});
|
|
320
|
+
const options = page.getByRole("radiogroup").getByRole("radio");
|
|
321
|
+
yield (0, fixtures_1.expect)(options.nth(0)).toHaveCSS("border-top-color", "rgb(80, 80, 80)");
|
|
322
|
+
yield (0, fixtures_1.expect)(options.nth(1)).toHaveCSS("border-top-color", "rgb(80, 80, 80)");
|
|
323
|
+
}));
|
|
324
|
+
(0, fixtures_1.test)("validationStatus 'error' is applied correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
325
|
+
yield initTestBed(`
|
|
326
|
+
<Theme
|
|
327
|
+
borderColor-RadioGroupOption-error="rgb(255, 32, 0)"
|
|
328
|
+
borderColor-checked-RadioGroupOption="rgb(80, 80, 80)"
|
|
329
|
+
>
|
|
330
|
+
<RadioGroup validationStatus="error" initialValue="1">
|
|
331
|
+
<Option value="1">Option 1</Option>
|
|
332
|
+
<Option value="2">Option 2</Option>
|
|
333
|
+
</RadioGroup>
|
|
334
|
+
</Theme>
|
|
335
|
+
`);
|
|
336
|
+
const options = page.getByRole("radiogroup").getByRole("radio");
|
|
337
|
+
yield (0, fixtures_1.expect)(options.nth(0)).toHaveCSS("border-top-color", "rgb(255, 32, 0)");
|
|
338
|
+
yield (0, fixtures_1.expect)(options.nth(1)).toHaveCSS("border-top-color", "rgb(80, 80, 80)");
|
|
339
|
+
}));
|
|
340
|
+
(0, fixtures_1.test)("validationStatus 'warning' is applied correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
341
|
+
yield initTestBed(`
|
|
342
|
+
<RadioGroup validationStatus="warning" initialValue="1">
|
|
343
|
+
<Option value="1">Option 1</Option>
|
|
344
|
+
<Option value="2">Option 2</Option>
|
|
345
|
+
</RadioGroup>
|
|
346
|
+
`, {
|
|
347
|
+
testThemeVars: {
|
|
348
|
+
"borderColor-RadioGroupOption-warning": "rgb(255, 180, 0)",
|
|
349
|
+
"borderColor-checked-RadioGroupOption": "rgb(80, 80, 80)",
|
|
350
|
+
},
|
|
351
|
+
});
|
|
352
|
+
const options = page.getByRole("radiogroup").getByRole("radio");
|
|
353
|
+
yield (0, fixtures_1.expect)(options.nth(0)).toHaveCSS("border-top-color", "rgb(255, 180, 0)");
|
|
354
|
+
yield (0, fixtures_1.expect)(options.nth(1)).toHaveCSS("border-top-color", "rgb(80, 80, 80)");
|
|
355
|
+
}));
|
|
356
|
+
(0, fixtures_1.test)("validationStatus 'valid' is applied correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
357
|
+
yield initTestBed(`
|
|
358
|
+
<RadioGroup validationStatus="valid" initialValue="1">
|
|
359
|
+
<Option value="1">Option 1</Option>
|
|
360
|
+
<Option value="2">Option 2</Option>
|
|
361
|
+
</RadioGroup>
|
|
362
|
+
`, {
|
|
363
|
+
testThemeVars: {
|
|
364
|
+
"borderColor-RadioGroupOption-success": "rgb(0, 180, 0)",
|
|
365
|
+
"borderColor-checked-RadioGroupOption": "rgb(80, 80, 80)",
|
|
366
|
+
},
|
|
367
|
+
});
|
|
368
|
+
const options = page.getByRole("radiogroup").getByRole("radio");
|
|
369
|
+
yield (0, fixtures_1.expect)(options.nth(1)).toHaveCSS("border-top-color", "rgb(80, 80, 80)");
|
|
370
|
+
yield (0, fixtures_1.expect)(options.nth(0)).toHaveCSS("border-top-color", "rgb(0, 180, 0)");
|
|
371
|
+
}));
|
|
372
|
+
(0, fixtures_1.test)("label is rendered if provided", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
373
|
+
yield initTestBed(`
|
|
374
|
+
<RadioGroup label="Test Label" initialValue="1">
|
|
375
|
+
<Option value="1">Option 1</Option>
|
|
376
|
+
<Option value="2">Option 2</Option>
|
|
377
|
+
</RadioGroup>
|
|
378
|
+
`);
|
|
379
|
+
const labels = page.locator("label");
|
|
380
|
+
yield (0, fixtures_1.expect)(labels).toHaveCount(3);
|
|
381
|
+
yield (0, fixtures_1.expect)(labels.nth(0)).toHaveText("Test Label");
|
|
382
|
+
yield (0, fixtures_1.expect)(labels.nth(1)).toHaveText("Option 1");
|
|
383
|
+
yield (0, fixtures_1.expect)(labels.nth(2)).toHaveText("Option 2");
|
|
384
|
+
}));
|
|
385
|
+
(0, fixtures_1.test)("empty string label is not rendered", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
386
|
+
yield initTestBed(`
|
|
387
|
+
<RadioGroup initialValue="1">
|
|
388
|
+
<Option value="1">Option 1</Option>
|
|
389
|
+
<Option value="2">Option 2</Option>
|
|
390
|
+
</RadioGroup>
|
|
391
|
+
`);
|
|
392
|
+
const labels = page.locator("label");
|
|
393
|
+
yield (0, fixtures_1.expect)(labels).toHaveCount(2);
|
|
394
|
+
yield (0, fixtures_1.expect)(labels.nth(0)).toHaveText("Option 1");
|
|
395
|
+
yield (0, fixtures_1.expect)(labels.nth(1)).toHaveText("Option 2");
|
|
396
|
+
}));
|
|
397
|
+
(0, fixtures_1.test)("labelPosition=start positions label before input with ltr", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
398
|
+
yield initTestBed(`
|
|
399
|
+
<RadioGroup direction="ltr" label="test" labelPosition="start" initialValue="1">
|
|
400
|
+
<Option testId="option1" value="1">Option 1</Option>
|
|
401
|
+
<Option value="2">Option 2</Option>
|
|
402
|
+
</RadioGroup>
|
|
403
|
+
`);
|
|
404
|
+
const labels = page.locator("label");
|
|
405
|
+
(0, fixtures_1.expect)(labels).toHaveCount(3);
|
|
406
|
+
const { left: optionLeft } = yield (0, component_test_helpers_1.getBounds)(labels.nth(1));
|
|
407
|
+
const { right: labelRight } = yield (0, component_test_helpers_1.getBounds)(labels.nth(0));
|
|
408
|
+
(0, fixtures_1.expect)(labelRight).toBeLessThan(optionLeft);
|
|
409
|
+
}));
|
|
410
|
+
(0, fixtures_1.test)("labelPosition=start positions label after input with rtl", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
411
|
+
yield initTestBed(`
|
|
412
|
+
<RadioGroup direction="rtl" label="test" labelPosition="start" initialValue="1">
|
|
413
|
+
<Option testId="option1" value="1">Option 1</Option>
|
|
414
|
+
<Option value="2">Option 2</Option>
|
|
415
|
+
</RadioGroup>
|
|
416
|
+
`);
|
|
417
|
+
const labels = page.locator("label");
|
|
418
|
+
(0, fixtures_1.expect)(labels).toHaveCount(3);
|
|
419
|
+
const { left: optionLeft } = yield (0, component_test_helpers_1.getBounds)(labels.nth(0));
|
|
420
|
+
const { right: labelRight } = yield (0, component_test_helpers_1.getBounds)(labels.nth(2));
|
|
421
|
+
(0, fixtures_1.expect)(labelRight).toBeLessThan(optionLeft);
|
|
422
|
+
}));
|
|
423
|
+
(0, fixtures_1.test)("labelPosition=end positions label after input with ltr", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
424
|
+
yield initTestBed(`
|
|
425
|
+
<RadioGroup direction="ltr" label="test" labelPosition="end" initialValue="1">
|
|
426
|
+
<Option testId="option1" value="1">Option 1</Option>
|
|
427
|
+
<Option value="2">Option 2</Option>
|
|
428
|
+
</RadioGroup>
|
|
429
|
+
`);
|
|
430
|
+
const labels = page.locator("label");
|
|
431
|
+
(0, fixtures_1.expect)(labels).toHaveCount(3);
|
|
432
|
+
const { left: optionLeft } = yield (0, component_test_helpers_1.getBounds)(labels.nth(0));
|
|
433
|
+
const { right: labelRight } = yield (0, component_test_helpers_1.getBounds)(labels.nth(1));
|
|
434
|
+
(0, fixtures_1.expect)(labelRight).toBeLessThan(optionLeft);
|
|
435
|
+
}));
|
|
436
|
+
(0, fixtures_1.test)("labelPosition=end positions label after input with rtl", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
437
|
+
yield initTestBed(`
|
|
438
|
+
<RadioGroup direction="rtl" label="test" labelPosition="end" initialValue="1">
|
|
439
|
+
<Option testId="option1" value="1">Option 1</Option>
|
|
440
|
+
<Option value="2">Option 2</Option>
|
|
441
|
+
</RadioGroup>
|
|
442
|
+
`);
|
|
443
|
+
const labels = page.locator("label");
|
|
444
|
+
(0, fixtures_1.expect)(labels).toHaveCount(3);
|
|
445
|
+
(0, fixtures_1.expect)(labels.nth(2)).toHaveText("Option 2");
|
|
446
|
+
const { left: optionLeft } = yield (0, component_test_helpers_1.getBounds)(labels.nth(0));
|
|
447
|
+
const { right: labelRight } = yield (0, component_test_helpers_1.getBounds)(labels.nth(2));
|
|
448
|
+
(0, fixtures_1.expect)(optionLeft).toBeLessThan(labelRight);
|
|
449
|
+
}));
|
|
450
|
+
(0, fixtures_1.test)("value returns current input value", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
451
|
+
yield initTestBed(`
|
|
452
|
+
<Fragment>
|
|
453
|
+
<RadioGroup id="radioGroup" initialValue="2">
|
|
454
|
+
<Option value="1"></Option>
|
|
455
|
+
<Option value="2"></Option>
|
|
456
|
+
</RadioGroup>
|
|
457
|
+
<Text testId="valueDisplay">{radioGroup.value}</Text>
|
|
458
|
+
</Fragment>
|
|
459
|
+
`);
|
|
460
|
+
const valueDisplay = page.getByTestId("valueDisplay");
|
|
461
|
+
yield (0, fixtures_1.expect)(valueDisplay).toHaveText("2");
|
|
462
|
+
}));
|
|
463
|
+
// --- --- setValue
|
|
464
|
+
(0, fixtures_1.test)("setValue input value", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
465
|
+
yield initTestBed(`
|
|
466
|
+
<Fragment>
|
|
467
|
+
<RadioGroup id="radioGroup" initialValue="2">
|
|
468
|
+
<Option value="1"></Option>
|
|
469
|
+
<Option value="2"></Option>
|
|
470
|
+
</RadioGroup>
|
|
471
|
+
<Text testId="valueDisplay">{radioGroup.value}</Text>
|
|
472
|
+
<Button onClick="() => radioGroup.setValue('1')" testId="setValueButton">Set Value</Button>
|
|
473
|
+
</Fragment>
|
|
474
|
+
`);
|
|
475
|
+
const valueDisplay = page.getByTestId("valueDisplay");
|
|
476
|
+
yield (0, fixtures_1.expect)(valueDisplay).toHaveText("2");
|
|
477
|
+
yield page.getByTestId("setValueButton").click();
|
|
478
|
+
yield (0, fixtures_1.expect)(valueDisplay).toHaveText("1");
|
|
479
|
+
}));
|