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,414 @@
|
|
|
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
|
+
fixtures_1.test.describe("Basic Functionality", () => {
|
|
17
|
+
(0, fixtures_1.test)("renders with default props", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
18
|
+
yield initTestBed(`<ToneChangerButton />`);
|
|
19
|
+
yield (0, fixtures_1.expect)(page.getByRole("button")).toBeVisible();
|
|
20
|
+
}));
|
|
21
|
+
(0, fixtures_1.test)("displays light-to-dark icon in light mode", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
22
|
+
yield initTestBed(`
|
|
23
|
+
<App>
|
|
24
|
+
<ToneChangerButton />
|
|
25
|
+
<Text testId="theme-state">{activeThemeTone}</Text>
|
|
26
|
+
</App>
|
|
27
|
+
`);
|
|
28
|
+
// Verify we're in light mode
|
|
29
|
+
yield (0, fixtures_1.expect)(page.getByTestId("theme-state")).toHaveText("light");
|
|
30
|
+
const button = page.getByRole("button");
|
|
31
|
+
yield (0, fixtures_1.expect)(button).toBeVisible();
|
|
32
|
+
// Check that the icon exists within the button
|
|
33
|
+
const icon = button.locator("svg, img, [data-testid*='icon']").first();
|
|
34
|
+
yield (0, fixtures_1.expect)(icon).toBeVisible();
|
|
35
|
+
}));
|
|
36
|
+
(0, fixtures_1.test)("displays dark-to-light icon in dark mode", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
37
|
+
yield initTestBed(`
|
|
38
|
+
<App>
|
|
39
|
+
<ToneChangerButton />
|
|
40
|
+
<Text testId="theme-state">{activeThemeTone}</Text>
|
|
41
|
+
</App>
|
|
42
|
+
`);
|
|
43
|
+
const button = page.getByRole("button");
|
|
44
|
+
// Switch to dark mode first
|
|
45
|
+
yield button.click();
|
|
46
|
+
yield (0, fixtures_1.expect)(page.getByTestId("theme-state")).toHaveText("dark");
|
|
47
|
+
// Verify the icon changes (should be different from light mode)
|
|
48
|
+
const icon = button.locator("svg, img, [data-testid*='icon']").first();
|
|
49
|
+
yield (0, fixtures_1.expect)(icon).toBeVisible();
|
|
50
|
+
}));
|
|
51
|
+
(0, fixtures_1.test)("switches from light to dark mode when clicked", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
52
|
+
yield initTestBed(`
|
|
53
|
+
<App>
|
|
54
|
+
<ToneChangerButton />
|
|
55
|
+
<Text testId="theme-state">{activeThemeTone}</Text>
|
|
56
|
+
</App>
|
|
57
|
+
`);
|
|
58
|
+
const button = page.getByRole("button");
|
|
59
|
+
// Initially in light mode
|
|
60
|
+
yield (0, fixtures_1.expect)(page.getByTestId("theme-state")).toHaveText("light");
|
|
61
|
+
// Click to switch to dark mode
|
|
62
|
+
yield button.click();
|
|
63
|
+
yield (0, fixtures_1.expect)(page.getByTestId("theme-state")).toHaveText("dark");
|
|
64
|
+
}));
|
|
65
|
+
(0, fixtures_1.test)("switches from dark to light mode when clicked", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
66
|
+
yield initTestBed(`
|
|
67
|
+
<App>
|
|
68
|
+
<ToneChangerButton />
|
|
69
|
+
<Text testId="theme-state">{activeThemeTone}</Text>
|
|
70
|
+
</App>
|
|
71
|
+
`);
|
|
72
|
+
const button = page.getByRole("button");
|
|
73
|
+
// Switch to dark mode first
|
|
74
|
+
yield button.click();
|
|
75
|
+
yield (0, fixtures_1.expect)(page.getByTestId("theme-state")).toHaveText("dark");
|
|
76
|
+
// Click again to switch back to light mode
|
|
77
|
+
yield button.click();
|
|
78
|
+
yield (0, fixtures_1.expect)(page.getByTestId("theme-state")).toHaveText("light");
|
|
79
|
+
}));
|
|
80
|
+
(0, fixtures_1.test)("toggles between modes multiple times", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
81
|
+
yield initTestBed(`
|
|
82
|
+
<App>
|
|
83
|
+
<ToneChangerButton />
|
|
84
|
+
<Text testId="theme-state">{activeThemeTone}</Text>
|
|
85
|
+
</App>
|
|
86
|
+
`);
|
|
87
|
+
const button = page.getByRole("button");
|
|
88
|
+
// Initial state: light
|
|
89
|
+
yield (0, fixtures_1.expect)(page.getByTestId("theme-state")).toHaveText("light");
|
|
90
|
+
// First toggle: light -> dark
|
|
91
|
+
yield button.click();
|
|
92
|
+
yield (0, fixtures_1.expect)(page.getByTestId("theme-state")).toHaveText("dark");
|
|
93
|
+
// Second toggle: dark -> light
|
|
94
|
+
yield button.click();
|
|
95
|
+
yield (0, fixtures_1.expect)(page.getByTestId("theme-state")).toHaveText("light");
|
|
96
|
+
// Third toggle: light -> dark
|
|
97
|
+
yield button.click();
|
|
98
|
+
yield (0, fixtures_1.expect)(page.getByTestId("theme-state")).toHaveText("dark");
|
|
99
|
+
}));
|
|
100
|
+
// =============================================================================
|
|
101
|
+
// CLICK EVENT TESTS
|
|
102
|
+
// =============================================================================
|
|
103
|
+
fixtures_1.test.describe("click event", () => {
|
|
104
|
+
(0, fixtures_1.test)("fires click event with 'dark' when switching to dark mode", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
105
|
+
const { testStateDriver } = yield initTestBed(`
|
|
106
|
+
<App>
|
|
107
|
+
<ToneChangerButton onClick="arg => testState = arg" />
|
|
108
|
+
<Text testId="theme-state">{activeThemeTone}</Text>
|
|
109
|
+
</App>
|
|
110
|
+
`);
|
|
111
|
+
const button = page.getByRole("button");
|
|
112
|
+
// Initially in light mode
|
|
113
|
+
yield (0, fixtures_1.expect)(page.getByTestId("theme-state")).toHaveText("light");
|
|
114
|
+
// Click to switch to dark mode
|
|
115
|
+
yield button.click();
|
|
116
|
+
yield (0, fixtures_1.expect)(page.getByTestId("theme-state")).toHaveText("dark");
|
|
117
|
+
yield fixtures_1.expect.poll(testStateDriver.testState).toEqual("dark");
|
|
118
|
+
}));
|
|
119
|
+
(0, fixtures_1.test)("fires click event with 'light' when switching to light mode", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
120
|
+
const { testStateDriver } = yield initTestBed(`
|
|
121
|
+
<App>
|
|
122
|
+
<ToneChangerButton onClick="arg => testState = arg" />
|
|
123
|
+
<Text testId="theme-state">{activeThemeTone}</Text>
|
|
124
|
+
</App>
|
|
125
|
+
`);
|
|
126
|
+
const button = page.getByRole("button");
|
|
127
|
+
// Switch to dark mode first
|
|
128
|
+
yield button.click();
|
|
129
|
+
yield (0, fixtures_1.expect)(page.getByTestId("theme-state")).toHaveText("dark");
|
|
130
|
+
// Click again to switch to light mode
|
|
131
|
+
yield button.click();
|
|
132
|
+
yield (0, fixtures_1.expect)(page.getByTestId("theme-state")).toHaveText("light");
|
|
133
|
+
yield fixtures_1.expect.poll(testStateDriver.testState).toEqual("light");
|
|
134
|
+
}));
|
|
135
|
+
(0, fixtures_1.test)("fires click event on each toggle", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
136
|
+
// TODO: Investigate why the onClick event handler is not being called
|
|
137
|
+
const { testStateDriver } = yield initTestBed(`
|
|
138
|
+
<App>
|
|
139
|
+
<ToneChangerButton onClick="testState = testState == null ? 1 : testState + 1" />
|
|
140
|
+
<Text testId="theme-state">{activeThemeTone}</Text>
|
|
141
|
+
</App>
|
|
142
|
+
`);
|
|
143
|
+
const button = page.getByRole("button");
|
|
144
|
+
// First click
|
|
145
|
+
yield button.click();
|
|
146
|
+
yield fixtures_1.expect.poll(testStateDriver.testState).toEqual(1);
|
|
147
|
+
// Second click
|
|
148
|
+
yield button.click();
|
|
149
|
+
yield fixtures_1.expect.poll(testStateDriver.testState).toEqual(2);
|
|
150
|
+
// Third click
|
|
151
|
+
yield button.click();
|
|
152
|
+
yield fixtures_1.expect.poll(testStateDriver.testState).toEqual(3);
|
|
153
|
+
}));
|
|
154
|
+
});
|
|
155
|
+
// =============================================================================
|
|
156
|
+
// ICON PROPERTY TESTS
|
|
157
|
+
// =============================================================================
|
|
158
|
+
fixtures_1.test.describe("icon properties", () => {
|
|
159
|
+
(0, fixtures_1.test)("uses custom lightToDarkIcon", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
160
|
+
yield initTestBed(`
|
|
161
|
+
<App>
|
|
162
|
+
<ToneChangerButton lightToDarkIcon="custom-light-icon" />
|
|
163
|
+
<Text testId="theme-state">{activeThemeTone}</Text>
|
|
164
|
+
</App>
|
|
165
|
+
`);
|
|
166
|
+
// Verify we're in light mode and icon is visible
|
|
167
|
+
yield (0, fixtures_1.expect)(page.getByTestId("theme-state")).toHaveText("light");
|
|
168
|
+
const button = page.getByRole("button");
|
|
169
|
+
const icon = button.locator("svg, img, [data-testid*='icon']").first();
|
|
170
|
+
yield (0, fixtures_1.expect)(icon).toBeVisible();
|
|
171
|
+
}));
|
|
172
|
+
(0, fixtures_1.test)("uses custom darkToLightIcon", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
173
|
+
yield initTestBed(`
|
|
174
|
+
<App>
|
|
175
|
+
<ToneChangerButton darkToLightIcon="custom-dark-icon" />
|
|
176
|
+
<Text testId="theme-state">{activeThemeTone}</Text>
|
|
177
|
+
</App>
|
|
178
|
+
`);
|
|
179
|
+
const button = page.getByRole("button");
|
|
180
|
+
// Switch to dark mode to see dark-to-light icon
|
|
181
|
+
yield button.click();
|
|
182
|
+
yield (0, fixtures_1.expect)(page.getByTestId("theme-state")).toHaveText("dark");
|
|
183
|
+
const icon = button.locator("svg, img, [data-testid*='icon']").first();
|
|
184
|
+
yield (0, fixtures_1.expect)(icon).toBeVisible();
|
|
185
|
+
}));
|
|
186
|
+
(0, fixtures_1.test)("handles null lightToDarkIcon gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
187
|
+
yield initTestBed(`
|
|
188
|
+
<App>
|
|
189
|
+
<ToneChangerButton lightToDarkIcon="{null}" />
|
|
190
|
+
<Text testId="theme-state">{activeThemeTone}</Text>
|
|
191
|
+
</App>
|
|
192
|
+
`);
|
|
193
|
+
// Should still render and be functional
|
|
194
|
+
yield (0, fixtures_1.expect)(page.getByTestId("theme-state")).toHaveText("light");
|
|
195
|
+
const button = page.getByRole("button");
|
|
196
|
+
yield (0, fixtures_1.expect)(button).toBeVisible();
|
|
197
|
+
// Should still be able to toggle
|
|
198
|
+
yield button.click();
|
|
199
|
+
yield (0, fixtures_1.expect)(page.getByTestId("theme-state")).toHaveText("dark");
|
|
200
|
+
}));
|
|
201
|
+
(0, fixtures_1.test)("handles null darkToLightIcon gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
202
|
+
yield initTestBed(`
|
|
203
|
+
<App>
|
|
204
|
+
<ToneChangerButton darkToLightIcon="{null}" />
|
|
205
|
+
<Text testId="theme-state">{activeThemeTone}</Text>
|
|
206
|
+
</App>
|
|
207
|
+
`);
|
|
208
|
+
const button = page.getByRole("button");
|
|
209
|
+
// Switch to dark mode
|
|
210
|
+
yield button.click();
|
|
211
|
+
yield (0, fixtures_1.expect)(page.getByTestId("theme-state")).toHaveText("dark");
|
|
212
|
+
// Should still render and be functional
|
|
213
|
+
yield (0, fixtures_1.expect)(button).toBeVisible();
|
|
214
|
+
// Should still be able to toggle back
|
|
215
|
+
yield button.click();
|
|
216
|
+
yield (0, fixtures_1.expect)(page.getByTestId("theme-state")).toHaveText("light");
|
|
217
|
+
}));
|
|
218
|
+
(0, fixtures_1.test)("handles undefined icon properties gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
219
|
+
yield initTestBed(`
|
|
220
|
+
<App>
|
|
221
|
+
<ToneChangerButton lightToDarkIcon="{undefined}" darkToLightIcon="{undefined}" />
|
|
222
|
+
<Text testId="theme-state">{activeThemeTone}</Text>
|
|
223
|
+
</App>
|
|
224
|
+
`);
|
|
225
|
+
const button = page.getByRole("button");
|
|
226
|
+
yield (0, fixtures_1.expect)(button).toBeVisible();
|
|
227
|
+
// Should still function for toggling
|
|
228
|
+
yield button.click();
|
|
229
|
+
yield (0, fixtures_1.expect)(page.getByTestId("theme-state")).toHaveText("dark");
|
|
230
|
+
yield button.click();
|
|
231
|
+
yield (0, fixtures_1.expect)(page.getByTestId("theme-state")).toHaveText("light");
|
|
232
|
+
}));
|
|
233
|
+
(0, fixtures_1.test)("handles non-string icon properties", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
234
|
+
yield initTestBed(`
|
|
235
|
+
<App>
|
|
236
|
+
<ToneChangerButton lightToDarkIcon="{123}" darkToLightIcon="{true}" />
|
|
237
|
+
<Text testId="theme-state">{activeThemeTone}</Text>
|
|
238
|
+
</App>
|
|
239
|
+
`);
|
|
240
|
+
const button = page.getByRole("button");
|
|
241
|
+
yield (0, fixtures_1.expect)(button).toBeVisible();
|
|
242
|
+
// Should still function for toggling despite invalid icon values
|
|
243
|
+
yield button.click();
|
|
244
|
+
yield (0, fixtures_1.expect)(page.getByTestId("theme-state")).toHaveText("dark");
|
|
245
|
+
}));
|
|
246
|
+
(0, fixtures_1.test)("handles very long unicode characters in icon names", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
247
|
+
yield initTestBed(`
|
|
248
|
+
<App>
|
|
249
|
+
<ToneChangerButton lightToDarkIcon="👨👩👧👦🌟✨" darkToLightIcon="中文图标名称" />
|
|
250
|
+
<Text testId="theme-state">{activeThemeTone}</Text>
|
|
251
|
+
</App>
|
|
252
|
+
`);
|
|
253
|
+
const button = page.getByRole("button");
|
|
254
|
+
yield (0, fixtures_1.expect)(button).toBeVisible();
|
|
255
|
+
// Should still function despite unusual icon names
|
|
256
|
+
yield button.click();
|
|
257
|
+
yield (0, fixtures_1.expect)(page.getByTestId("theme-state")).toHaveText("dark");
|
|
258
|
+
}));
|
|
259
|
+
});
|
|
260
|
+
});
|
|
261
|
+
// =============================================================================
|
|
262
|
+
// ACCESSIBILITY TESTS
|
|
263
|
+
// =============================================================================
|
|
264
|
+
fixtures_1.test.describe("Accessibility", () => {
|
|
265
|
+
(0, fixtures_1.test)("has button role", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
266
|
+
yield initTestBed(`<ToneChangerButton />`);
|
|
267
|
+
const button = page.getByRole("button");
|
|
268
|
+
yield (0, fixtures_1.expect)(button).toBeVisible();
|
|
269
|
+
}));
|
|
270
|
+
(0, fixtures_1.test)("is keyboard accessible with Enter key", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
271
|
+
yield initTestBed(`
|
|
272
|
+
<App>
|
|
273
|
+
<ToneChangerButton />
|
|
274
|
+
<Text testId="theme-state">{activeThemeTone}</Text>
|
|
275
|
+
</App>
|
|
276
|
+
`);
|
|
277
|
+
const button = page.getByRole("button");
|
|
278
|
+
yield button.focus();
|
|
279
|
+
yield (0, fixtures_1.expect)(button).toBeFocused();
|
|
280
|
+
// Initially in light mode
|
|
281
|
+
yield (0, fixtures_1.expect)(page.getByTestId("theme-state")).toHaveText("light");
|
|
282
|
+
// Press Enter to toggle
|
|
283
|
+
yield page.keyboard.press("Enter");
|
|
284
|
+
yield (0, fixtures_1.expect)(page.getByTestId("theme-state")).toHaveText("dark");
|
|
285
|
+
}));
|
|
286
|
+
(0, fixtures_1.test)("is keyboard accessible with Space key", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
287
|
+
yield initTestBed(`
|
|
288
|
+
<App>
|
|
289
|
+
<ToneChangerButton />
|
|
290
|
+
<Text testId="theme-state">{activeThemeTone}</Text>
|
|
291
|
+
</App>
|
|
292
|
+
`);
|
|
293
|
+
const button = page.getByRole("button");
|
|
294
|
+
yield button.focus();
|
|
295
|
+
yield (0, fixtures_1.expect)(button).toBeFocused();
|
|
296
|
+
// Initially in light mode
|
|
297
|
+
yield (0, fixtures_1.expect)(page.getByTestId("theme-state")).toHaveText("light");
|
|
298
|
+
// Press Space to toggle
|
|
299
|
+
yield page.keyboard.press("Space");
|
|
300
|
+
yield (0, fixtures_1.expect)(page.getByTestId("theme-state")).toHaveText("dark");
|
|
301
|
+
}));
|
|
302
|
+
(0, fixtures_1.test)("maintains focus during interactions", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
303
|
+
yield initTestBed(`
|
|
304
|
+
<App>
|
|
305
|
+
<ToneChangerButton />
|
|
306
|
+
<Text testId="theme-state">{activeThemeTone}</Text>
|
|
307
|
+
</App>
|
|
308
|
+
`);
|
|
309
|
+
const button = page.getByRole("button");
|
|
310
|
+
yield button.focus();
|
|
311
|
+
yield button.click();
|
|
312
|
+
// Focus should be maintained after click
|
|
313
|
+
yield (0, fixtures_1.expect)(button).toBeFocused();
|
|
314
|
+
}));
|
|
315
|
+
(0, fixtures_1.test)("is focusable via Tab navigation", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
316
|
+
yield initTestBed(`
|
|
317
|
+
<App>
|
|
318
|
+
<Button>Before</Button>
|
|
319
|
+
<ToneChangerButton />
|
|
320
|
+
<Button>After</Button>
|
|
321
|
+
</App>
|
|
322
|
+
`);
|
|
323
|
+
// Focus the first button
|
|
324
|
+
yield page.getByRole("button", { name: "Before" }).focus();
|
|
325
|
+
// Tab to ToneChangerButton
|
|
326
|
+
yield page.keyboard.press("Tab");
|
|
327
|
+
const toneButton = page.getByRole("button").nth(1); // ToneChangerButton is the second button
|
|
328
|
+
yield (0, fixtures_1.expect)(toneButton).toBeFocused();
|
|
329
|
+
// Tab to the next button
|
|
330
|
+
yield page.keyboard.press("Tab");
|
|
331
|
+
yield (0, fixtures_1.expect)(page.getByRole("button", { name: "After" })).toBeFocused();
|
|
332
|
+
}));
|
|
333
|
+
(0, fixtures_1.test)("has appropriate ARIA attributes", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
334
|
+
yield initTestBed(`<ToneChangerButton />`);
|
|
335
|
+
const button = page.getByRole("button");
|
|
336
|
+
// Should be focusable (not disabled)
|
|
337
|
+
yield (0, fixtures_1.expect)(button).not.toBeDisabled();
|
|
338
|
+
// Should have role button (implicit from getByRole test above)
|
|
339
|
+
yield (0, fixtures_1.expect)(button).toBeVisible();
|
|
340
|
+
}));
|
|
341
|
+
});
|
|
342
|
+
// =============================================================================
|
|
343
|
+
// OTHER EDGE CASE TESTS
|
|
344
|
+
// =============================================================================
|
|
345
|
+
fixtures_1.test.describe("Other Edge Cases", () => {
|
|
346
|
+
(0, fixtures_1.test)("handles no props gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
347
|
+
yield initTestBed(`<ToneChangerButton/>`);
|
|
348
|
+
const button = page.getByRole("button");
|
|
349
|
+
yield (0, fixtures_1.expect)(button).toBeVisible();
|
|
350
|
+
}));
|
|
351
|
+
(0, fixtures_1.test)("works within different container components", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
352
|
+
yield initTestBed(`
|
|
353
|
+
<App>
|
|
354
|
+
<Card>
|
|
355
|
+
<ToneChangerButton />
|
|
356
|
+
</Card>
|
|
357
|
+
<Text testId="theme-state">{activeThemeTone}</Text>
|
|
358
|
+
</App>
|
|
359
|
+
`);
|
|
360
|
+
const button = page.getByRole("button");
|
|
361
|
+
yield (0, fixtures_1.expect)(button).toBeVisible();
|
|
362
|
+
// Should still function normally
|
|
363
|
+
yield button.click();
|
|
364
|
+
yield (0, fixtures_1.expect)(page.getByTestId("theme-state")).toHaveText("dark");
|
|
365
|
+
}));
|
|
366
|
+
(0, fixtures_1.test)("maintains state consistency across multiple instances", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
367
|
+
yield initTestBed(`
|
|
368
|
+
<App>
|
|
369
|
+
<ToneChangerButton testId="button1" />
|
|
370
|
+
<ToneChangerButton testId="button2" />
|
|
371
|
+
<Text testId="theme-state">{activeThemeTone}</Text>
|
|
372
|
+
</App>
|
|
373
|
+
`);
|
|
374
|
+
const button1 = page.getByTestId("button1");
|
|
375
|
+
const button2 = page.getByTestId("button2");
|
|
376
|
+
// Initially in light mode
|
|
377
|
+
yield (0, fixtures_1.expect)(page.getByTestId("theme-state")).toHaveText("light");
|
|
378
|
+
// Click first button to switch to dark
|
|
379
|
+
yield button1.click();
|
|
380
|
+
yield (0, fixtures_1.expect)(page.getByTestId("theme-state")).toHaveText("dark");
|
|
381
|
+
// Click second button to switch back to light
|
|
382
|
+
yield button2.click();
|
|
383
|
+
yield (0, fixtures_1.expect)(page.getByTestId("theme-state")).toHaveText("light");
|
|
384
|
+
}));
|
|
385
|
+
(0, fixtures_1.test)("handles rapid successive clicks", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
386
|
+
yield initTestBed(`
|
|
387
|
+
<App>
|
|
388
|
+
<ToneChangerButton />
|
|
389
|
+
<Text testId="theme-state">{activeThemeTone}</Text>
|
|
390
|
+
</App>
|
|
391
|
+
`);
|
|
392
|
+
const button = page.getByRole("button");
|
|
393
|
+
// Perform rapid clicks
|
|
394
|
+
yield button.click();
|
|
395
|
+
yield button.click();
|
|
396
|
+
yield button.click();
|
|
397
|
+
yield button.click();
|
|
398
|
+
// Should end up in light mode (even number of clicks)
|
|
399
|
+
yield (0, fixtures_1.expect)(page.getByTestId("theme-state")).toHaveText("light");
|
|
400
|
+
}));
|
|
401
|
+
(0, fixtures_1.test)("handles empty string icon properties", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
402
|
+
yield initTestBed(`
|
|
403
|
+
<App>
|
|
404
|
+
<ToneChangerButton lightToDarkIcon="" darkToLightIcon="" />
|
|
405
|
+
<Text testId="theme-state">{activeThemeTone}</Text>
|
|
406
|
+
</App>
|
|
407
|
+
`);
|
|
408
|
+
const button = page.getByRole("button");
|
|
409
|
+
yield (0, fixtures_1.expect)(button).toBeVisible();
|
|
410
|
+
// Should still function despite empty icon names
|
|
411
|
+
yield button.click();
|
|
412
|
+
yield (0, fixtures_1.expect)(page.getByTestId("theme-state")).toHaveText("dark");
|
|
413
|
+
}));
|
|
414
|
+
});
|
|
@@ -0,0 +1,89 @@
|
|
|
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
|
+
fixtures_1.test.describe("Basic Functionality", () => {
|
|
17
|
+
(0, fixtures_1.test)("renders in light mode by default", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
18
|
+
yield initTestBed(`
|
|
19
|
+
<App>
|
|
20
|
+
<ToneSwitch />
|
|
21
|
+
<Text>{activeThemeTone}</Text>
|
|
22
|
+
</App>
|
|
23
|
+
`);
|
|
24
|
+
const toggle = page.getByRole("switch");
|
|
25
|
+
yield (0, fixtures_1.expect)(toggle).toBeVisible();
|
|
26
|
+
yield (0, fixtures_1.expect)(page.getByText("light")).toBeVisible();
|
|
27
|
+
}));
|
|
28
|
+
(0, fixtures_1.test)("toggles to dark mode when clicked", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
29
|
+
yield initTestBed(`
|
|
30
|
+
<App>
|
|
31
|
+
<ToneSwitch />
|
|
32
|
+
<Text>{activeThemeTone}</Text>
|
|
33
|
+
</App>
|
|
34
|
+
`);
|
|
35
|
+
const toggle = page.getByRole("switch");
|
|
36
|
+
yield (0, fixtures_1.expect)(toggle).toBeVisible();
|
|
37
|
+
yield toggle.click({ force: true });
|
|
38
|
+
yield (0, fixtures_1.expect)(page.getByText("dark")).toBeVisible();
|
|
39
|
+
yield (0, fixtures_1.expect)(toggle).toBeChecked();
|
|
40
|
+
}));
|
|
41
|
+
(0, fixtures_1.test)("toggles back to light mode when clicked again", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
42
|
+
yield initTestBed(`
|
|
43
|
+
<App>
|
|
44
|
+
<ToneSwitch />
|
|
45
|
+
<Text>{activeThemeTone}</Text>
|
|
46
|
+
</App>
|
|
47
|
+
`);
|
|
48
|
+
const toggle = page.getByRole("switch");
|
|
49
|
+
yield (0, fixtures_1.expect)(toggle).toBeVisible();
|
|
50
|
+
yield toggle.click({ force: true });
|
|
51
|
+
yield (0, fixtures_1.expect)(page.getByText("dark")).toBeVisible();
|
|
52
|
+
yield (0, fixtures_1.expect)(toggle).toBeChecked();
|
|
53
|
+
yield toggle.click({ force: true });
|
|
54
|
+
yield (0, fixtures_1.expect)(page.getByText("light")).toBeVisible();
|
|
55
|
+
yield (0, fixtures_1.expect)(toggle).not.toBeChecked();
|
|
56
|
+
}));
|
|
57
|
+
});
|
|
58
|
+
// =============================================================================
|
|
59
|
+
// ACCESSIBILITY TESTS
|
|
60
|
+
// =============================================================================
|
|
61
|
+
fixtures_1.test.describe("Accessibility", () => {
|
|
62
|
+
(0, fixtures_1.test)("has switch role", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
63
|
+
yield initTestBed(`<ToneSwitch />`);
|
|
64
|
+
const toggle = page.getByRole("switch");
|
|
65
|
+
yield (0, fixtures_1.expect)(toggle).toBeVisible();
|
|
66
|
+
}));
|
|
67
|
+
(0, fixtures_1.test)("is keyboard accessible with Space key", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
68
|
+
yield initTestBed(`<ToneSwitch />`);
|
|
69
|
+
const toggle = page.getByRole("switch");
|
|
70
|
+
yield toggle.focus();
|
|
71
|
+
yield (0, fixtures_1.expect)(toggle).toBeFocused();
|
|
72
|
+
yield page.keyboard.press("Space");
|
|
73
|
+
yield (0, fixtures_1.expect)(toggle).toBeChecked();
|
|
74
|
+
}));
|
|
75
|
+
(0, fixtures_1.test)("maintains focus during interactions", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
76
|
+
yield initTestBed(`<ToneSwitch />`);
|
|
77
|
+
const toggle = page.getByRole("switch");
|
|
78
|
+
yield toggle.focus();
|
|
79
|
+
yield toggle.click({ force: true });
|
|
80
|
+
yield (0, fixtures_1.expect)(toggle).toBeFocused();
|
|
81
|
+
}));
|
|
82
|
+
(0, fixtures_1.test)("has appropriate aria-checked state", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
83
|
+
yield initTestBed(`<ToneSwitch />`);
|
|
84
|
+
const toggle = page.getByRole("switch");
|
|
85
|
+
yield (0, fixtures_1.expect)(toggle).toHaveAttribute("aria-checked", "false");
|
|
86
|
+
yield toggle.click({ force: true });
|
|
87
|
+
yield (0, fixtures_1.expect)(toggle).toHaveAttribute("aria-checked", "true");
|
|
88
|
+
}));
|
|
89
|
+
});
|