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,838 @@
|
|
|
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 table of contents links with headings", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
18
|
+
yield page.setViewportSize({ height: 600, width: 800 });
|
|
19
|
+
yield initTestBed(`
|
|
20
|
+
<Page>
|
|
21
|
+
<HStack>
|
|
22
|
+
<VStack gap="800px">
|
|
23
|
+
<Heading value="First Heading" />
|
|
24
|
+
<Heading value="Second Heading" />
|
|
25
|
+
<Heading value="Third Heading" />
|
|
26
|
+
bottom of the page text
|
|
27
|
+
</VStack>
|
|
28
|
+
<TableOfContents />
|
|
29
|
+
</HStack>
|
|
30
|
+
</Page>`);
|
|
31
|
+
const tocLinks = page.getByRole("link", { name: /Heading/ });
|
|
32
|
+
yield (0, fixtures_1.expect)(tocLinks).toHaveCount(3);
|
|
33
|
+
yield (0, fixtures_1.expect)(page.getByRole("link", { name: "First Heading" })).toBeVisible();
|
|
34
|
+
yield (0, fixtures_1.expect)(page.getByRole("link", { name: "Second Heading" })).toBeVisible();
|
|
35
|
+
yield (0, fixtures_1.expect)(page.getByRole("link", { name: "Third Heading" })).toBeVisible();
|
|
36
|
+
}));
|
|
37
|
+
(0, fixtures_1.test)("renders table of contents with bookmarks", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
38
|
+
yield page.setViewportSize({ height: 600, width: 800 });
|
|
39
|
+
yield initTestBed(`
|
|
40
|
+
<Page>
|
|
41
|
+
<HStack>
|
|
42
|
+
<VStack gap="800px">
|
|
43
|
+
<Bookmark id="section1" title="Section One" level="{2}">
|
|
44
|
+
section one content
|
|
45
|
+
</Bookmark>
|
|
46
|
+
<Bookmark id="section2" title="Section Two" level="{3}">
|
|
47
|
+
section two content
|
|
48
|
+
</Bookmark>
|
|
49
|
+
bottom of the page text
|
|
50
|
+
</VStack>
|
|
51
|
+
<TableOfContents />
|
|
52
|
+
</HStack>
|
|
53
|
+
</Page>
|
|
54
|
+
`);
|
|
55
|
+
const tocLinks = page.getByRole("link");
|
|
56
|
+
yield (0, fixtures_1.expect)(tocLinks).toHaveCount(2);
|
|
57
|
+
yield (0, fixtures_1.expect)(page.getByRole("link", { name: "Section One" })).toBeVisible();
|
|
58
|
+
yield (0, fixtures_1.expect)(page.getByRole("link", { name: "Section Two" })).toBeVisible();
|
|
59
|
+
}));
|
|
60
|
+
(0, fixtures_1.test)("renders table of contents with mixed headings and bookmarks", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, }) {
|
|
61
|
+
yield page.setViewportSize({ height: 600, width: 800 });
|
|
62
|
+
yield initTestBed(`
|
|
63
|
+
<Page>
|
|
64
|
+
<HStack>
|
|
65
|
+
<VStack gap="800px">
|
|
66
|
+
<Heading level="h1" value="Main Title" />
|
|
67
|
+
<Bookmark id="intro" title="Introduction" level="{2}">
|
|
68
|
+
introduction content
|
|
69
|
+
</Bookmark>
|
|
70
|
+
<Heading level="h2" value="Chapter One" />
|
|
71
|
+
<Bookmark id="summary" title="Summary" level="{3}">
|
|
72
|
+
summary content
|
|
73
|
+
</Bookmark>
|
|
74
|
+
bottom of the page text
|
|
75
|
+
</VStack>
|
|
76
|
+
<TableOfContents />
|
|
77
|
+
</HStack>
|
|
78
|
+
</Page>
|
|
79
|
+
`);
|
|
80
|
+
const tocLinks = page.getByRole("link");
|
|
81
|
+
yield (0, fixtures_1.expect)(tocLinks).toHaveCount(4);
|
|
82
|
+
yield (0, fixtures_1.expect)(page.getByRole("link", { name: "Main Title" })).toBeVisible();
|
|
83
|
+
yield (0, fixtures_1.expect)(page.getByRole("link", { name: "Introduction" })).toBeVisible();
|
|
84
|
+
yield (0, fixtures_1.expect)(page.getByRole("link", { name: "Chapter One" })).toBeVisible();
|
|
85
|
+
yield (0, fixtures_1.expect)(page.getByRole("link", { name: "Summary" })).toBeVisible();
|
|
86
|
+
}));
|
|
87
|
+
// =============================================================================
|
|
88
|
+
// DOCUMENTATION USAGE PATTERNS
|
|
89
|
+
// =============================================================================
|
|
90
|
+
fixtures_1.test.describe("Documentation Usage Patterns", () => {
|
|
91
|
+
(0, fixtures_1.test)("navigates to headings when clicked", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
92
|
+
yield page.setViewportSize({ height: 600, width: 800 });
|
|
93
|
+
yield initTestBed(`
|
|
94
|
+
<Page>
|
|
95
|
+
<HStack>
|
|
96
|
+
<VStack gap="800px">
|
|
97
|
+
<Heading level="h2" value="Section A" />
|
|
98
|
+
<Heading level="h2" value="Section B" />
|
|
99
|
+
<Heading level="h2" value="Section C" />
|
|
100
|
+
bottom of the page text
|
|
101
|
+
</VStack>
|
|
102
|
+
<TableOfContents />
|
|
103
|
+
</HStack>
|
|
104
|
+
</Page>
|
|
105
|
+
`);
|
|
106
|
+
const sectionA = page.getByRole("heading", { name: "Section A" });
|
|
107
|
+
const sectionB = page.getByRole("heading", { name: "Section B" });
|
|
108
|
+
const sectionC = page.getByRole("heading", { name: "Section C" });
|
|
109
|
+
// Initially, Section A should be visible
|
|
110
|
+
yield (0, fixtures_1.expect)(sectionA).toBeInViewport();
|
|
111
|
+
yield (0, fixtures_1.expect)(sectionB).not.toBeInViewport();
|
|
112
|
+
yield (0, fixtures_1.expect)(sectionC).not.toBeInViewport();
|
|
113
|
+
// Click on Section B in TOC
|
|
114
|
+
const sectionBLink = page.getByRole("link", { name: "Section B" });
|
|
115
|
+
yield sectionBLink.click();
|
|
116
|
+
yield (0, fixtures_1.expect)(sectionB).toBeInViewport();
|
|
117
|
+
// Click on Section C in TOC
|
|
118
|
+
const sectionCLink = page.getByRole("link", { name: "Section C" });
|
|
119
|
+
yield sectionCLink.click();
|
|
120
|
+
yield (0, fixtures_1.expect)(sectionB).not.toBeInViewport();
|
|
121
|
+
yield (0, fixtures_1.expect)(sectionC).toBeInViewport();
|
|
122
|
+
}));
|
|
123
|
+
(0, fixtures_1.test)("navigates to bookmarks when clicked", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
124
|
+
yield page.setViewportSize({ height: 600, width: 800 });
|
|
125
|
+
yield initTestBed(`
|
|
126
|
+
<Page>
|
|
127
|
+
<HStack>
|
|
128
|
+
<VStack gap="800px">
|
|
129
|
+
<Bookmark id="bookmark-a" title="Bookmark A" level="{2}">
|
|
130
|
+
bookmark a content
|
|
131
|
+
</Bookmark>
|
|
132
|
+
<Bookmark id="bookmark-b" title="Bookmark B" level="{2}">
|
|
133
|
+
bookmark b content
|
|
134
|
+
</Bookmark>
|
|
135
|
+
<Bookmark id="bookmark-c" title="Bookmark C" level="{2}">
|
|
136
|
+
bookmark c content
|
|
137
|
+
</Bookmark>
|
|
138
|
+
bottom of the page text
|
|
139
|
+
</VStack>
|
|
140
|
+
<TableOfContents />
|
|
141
|
+
</HStack>
|
|
142
|
+
</Page>
|
|
143
|
+
`);
|
|
144
|
+
const contentA = page.getByText("bookmark a content");
|
|
145
|
+
const contentB = page.getByText("bookmark b content");
|
|
146
|
+
const contentC = page.getByText("bookmark c content");
|
|
147
|
+
// Initially, Bookmark A should be visible
|
|
148
|
+
yield (0, fixtures_1.expect)(contentA).toBeInViewport();
|
|
149
|
+
yield (0, fixtures_1.expect)(contentB).not.toBeInViewport();
|
|
150
|
+
yield (0, fixtures_1.expect)(contentC).not.toBeInViewport();
|
|
151
|
+
// Click on Bookmark B in TOC
|
|
152
|
+
const bookmarkBLink = page.getByRole("link", { name: "Bookmark B" });
|
|
153
|
+
yield bookmarkBLink.click();
|
|
154
|
+
yield (0, fixtures_1.expect)(contentB).toBeInViewport();
|
|
155
|
+
// Click on Bookmark C in TOC
|
|
156
|
+
const bookmarkCLink = page.getByRole("link", { name: "Bookmark C" });
|
|
157
|
+
yield bookmarkCLink.click();
|
|
158
|
+
yield (0, fixtures_1.expect)(contentC).toBeInViewport();
|
|
159
|
+
}));
|
|
160
|
+
(0, fixtures_1.test)("shows active item in table of contents", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
161
|
+
yield page.setViewportSize({ height: 600, width: 800 });
|
|
162
|
+
yield initTestBed(`
|
|
163
|
+
<Page>
|
|
164
|
+
<HStack>
|
|
165
|
+
<VStack gap="800px">
|
|
166
|
+
<Heading level="h2" value="First Section" />
|
|
167
|
+
<Heading level="h2" value="Second Section" />
|
|
168
|
+
<Heading level="h2" value="Thirsd Section" />
|
|
169
|
+
bottom of the page text
|
|
170
|
+
</VStack>
|
|
171
|
+
<TableOfContents />
|
|
172
|
+
</HStack>
|
|
173
|
+
</Page>
|
|
174
|
+
`);
|
|
175
|
+
const secondHeading = page.getByRole("heading", { name: "Second Section" });
|
|
176
|
+
// Click on second section
|
|
177
|
+
const secondLink = page.getByRole("link", { name: "Second Section" });
|
|
178
|
+
yield secondLink.click();
|
|
179
|
+
yield (0, fixtures_1.expect)(secondHeading).toBeInViewport();
|
|
180
|
+
// Check if the active item has the correct class or styling
|
|
181
|
+
const activeItem = page.locator("[aria-current='page']");
|
|
182
|
+
yield (0, fixtures_1.expect)(activeItem).toHaveText("Second Section");
|
|
183
|
+
}));
|
|
184
|
+
});
|
|
185
|
+
// =============================================================================
|
|
186
|
+
// PROPERTY TESTS
|
|
187
|
+
// =============================================================================
|
|
188
|
+
fixtures_1.test.describe("maxHeadingLevel property", () => {
|
|
189
|
+
(0, fixtures_1.test)("limits headings to specified level", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
190
|
+
yield page.setViewportSize({ height: 600, width: 800 });
|
|
191
|
+
yield initTestBed(`
|
|
192
|
+
<Page>
|
|
193
|
+
<HStack>
|
|
194
|
+
<VStack gap="800px">
|
|
195
|
+
<Heading level="h1" value="H1 Title" />
|
|
196
|
+
<Heading level="h2" value="H2 Title" />
|
|
197
|
+
<Heading level="h3" value="H3 Title" />
|
|
198
|
+
<Heading level="h4" value="H4 Title" />
|
|
199
|
+
<Heading level="h5" value="H5 Title" />
|
|
200
|
+
<Heading level="h6" value="H6 Title" />
|
|
201
|
+
bottom of the page text
|
|
202
|
+
</VStack>
|
|
203
|
+
<TableOfContents maxHeadingLevel="{3}" />
|
|
204
|
+
</HStack>
|
|
205
|
+
</Page>
|
|
206
|
+
`);
|
|
207
|
+
// Should show H1, H2, H3 but not H4, H5, H6
|
|
208
|
+
yield (0, fixtures_1.expect)(page.getByRole("link", { name: "H1 Title" })).toBeVisible();
|
|
209
|
+
yield (0, fixtures_1.expect)(page.getByRole("link", { name: "H2 Title" })).toBeVisible();
|
|
210
|
+
yield (0, fixtures_1.expect)(page.getByRole("link", { name: "H3 Title" })).toBeVisible();
|
|
211
|
+
yield (0, fixtures_1.expect)(page.getByRole("link", { name: "H4 Title" })).not.toBeVisible();
|
|
212
|
+
yield (0, fixtures_1.expect)(page.getByRole("link", { name: "H5 Title" })).not.toBeVisible();
|
|
213
|
+
yield (0, fixtures_1.expect)(page.getByRole("link", { name: "H6 Title" })).not.toBeVisible();
|
|
214
|
+
}));
|
|
215
|
+
(0, fixtures_1.test)("shows only H1 when maxHeadingLevel is 1", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
216
|
+
yield page.setViewportSize({ height: 600, width: 800 });
|
|
217
|
+
yield initTestBed(`
|
|
218
|
+
<Page>
|
|
219
|
+
<HStack>
|
|
220
|
+
<VStack gap="800px">
|
|
221
|
+
<Heading level="h1" value="Only H1" />
|
|
222
|
+
<Heading level="h2" value="Hidden H2" />
|
|
223
|
+
<Heading level="h3" value="Hidden H3" />
|
|
224
|
+
bottom of the page text
|
|
225
|
+
</VStack>
|
|
226
|
+
<TableOfContents maxHeadingLevel="{1}" />
|
|
227
|
+
</HStack>
|
|
228
|
+
</Page>
|
|
229
|
+
`);
|
|
230
|
+
yield (0, fixtures_1.expect)(page.getByRole("link", { name: "Only H1" })).toBeVisible();
|
|
231
|
+
yield (0, fixtures_1.expect)(page.getByRole("link", { name: "Hidden H2" })).not.toBeVisible();
|
|
232
|
+
yield (0, fixtures_1.expect)(page.getByRole("link", { name: "Hidden H3" })).not.toBeVisible();
|
|
233
|
+
}));
|
|
234
|
+
(0, fixtures_1.test)("limits bookmarks to specified level", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
235
|
+
yield page.setViewportSize({ height: 600, width: 800 });
|
|
236
|
+
yield initTestBed(`
|
|
237
|
+
<Page>
|
|
238
|
+
<HStack>
|
|
239
|
+
<VStack gap="800px">
|
|
240
|
+
<Bookmark id="levelNone" title="Bookmark level none">
|
|
241
|
+
content no level
|
|
242
|
+
</Bookmark>
|
|
243
|
+
<Bookmark id="level1" title="Level 1 Bookmark" level="{1}">
|
|
244
|
+
level 1 content
|
|
245
|
+
</Bookmark>
|
|
246
|
+
<Bookmark id="level2" title="Level 2 Bookmark" level="{2}">
|
|
247
|
+
level 2 content
|
|
248
|
+
</Bookmark>
|
|
249
|
+
<Bookmark id="level3" title="Level 3 Bookmark" level="{3}">
|
|
250
|
+
level 3 content
|
|
251
|
+
</Bookmark>
|
|
252
|
+
<Bookmark id="level4" title="Level 4 Bookmark" level="{4}">
|
|
253
|
+
level 4 content
|
|
254
|
+
</Bookmark>
|
|
255
|
+
bottom of the page text
|
|
256
|
+
</VStack>
|
|
257
|
+
<TableOfContents maxHeadingLevel="{2}" />
|
|
258
|
+
</HStack>
|
|
259
|
+
</Page>
|
|
260
|
+
`);
|
|
261
|
+
yield (0, fixtures_1.expect)(page.getByRole("link", { name: "Bookmark level none" })).toBeVisible();
|
|
262
|
+
yield (0, fixtures_1.expect)(page.getByRole("link", { name: "Level 1 Bookmark" })).toBeVisible();
|
|
263
|
+
yield (0, fixtures_1.expect)(page.getByRole("link", { name: "Level 2 Bookmark" })).toBeVisible();
|
|
264
|
+
yield (0, fixtures_1.expect)(page.getByRole("link", { name: "Level 3 Bookmark" })).not.toBeVisible();
|
|
265
|
+
yield (0, fixtures_1.expect)(page.getByRole("link", { name: "Level 4 Bookmark" })).not.toBeVisible();
|
|
266
|
+
}));
|
|
267
|
+
});
|
|
268
|
+
fixtures_1.test.describe("omitH1 property", () => {
|
|
269
|
+
(0, fixtures_1.test)("excludes H1 headings when omitH1 is true", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
270
|
+
yield page.setViewportSize({ height: 600, width: 800 });
|
|
271
|
+
yield initTestBed(`
|
|
272
|
+
<Page>
|
|
273
|
+
<HStack>
|
|
274
|
+
<VStack gap="800px">
|
|
275
|
+
<Heading level="h1" value="H1 Title" />
|
|
276
|
+
<Heading level="h2" value="H2 Title" />
|
|
277
|
+
<Heading level="h3" value="H3 Title" />
|
|
278
|
+
bottom of the page text
|
|
279
|
+
</VStack>
|
|
280
|
+
<TableOfContents omitH1="{true}" />
|
|
281
|
+
</HStack>
|
|
282
|
+
</Page>
|
|
283
|
+
`);
|
|
284
|
+
yield (0, fixtures_1.expect)(page.getByRole("link", { name: "H1 Title" })).not.toBeVisible();
|
|
285
|
+
yield (0, fixtures_1.expect)(page.getByRole("link", { name: "H2 Title" })).toBeVisible();
|
|
286
|
+
yield (0, fixtures_1.expect)(page.getByRole("link", { name: "H3 Title" })).toBeVisible();
|
|
287
|
+
}));
|
|
288
|
+
(0, fixtures_1.test)("includes H1 headings when omitH1 is false", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
289
|
+
yield page.setViewportSize({ height: 600, width: 800 });
|
|
290
|
+
yield initTestBed(`
|
|
291
|
+
<Page>
|
|
292
|
+
<HStack>
|
|
293
|
+
<VStack gap="800px">
|
|
294
|
+
<Heading level="h1" value="Page Title" />
|
|
295
|
+
<Heading level="h2" value="Section Title" />
|
|
296
|
+
bottom of the page text
|
|
297
|
+
</VStack>
|
|
298
|
+
<TableOfContents omitH1="{false}" />
|
|
299
|
+
</HStack>
|
|
300
|
+
</Page>
|
|
301
|
+
`);
|
|
302
|
+
yield (0, fixtures_1.expect)(page.getByRole("link", { name: "Page Title" })).toBeVisible();
|
|
303
|
+
yield (0, fixtures_1.expect)(page.getByRole("link", { name: "Section Title" })).toBeVisible();
|
|
304
|
+
}));
|
|
305
|
+
(0, fixtures_1.test)("excludes level 1 bookmarks when omitH1 is true", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
306
|
+
yield page.setViewportSize({ height: 600, width: 800 });
|
|
307
|
+
yield initTestBed(`
|
|
308
|
+
<Page>
|
|
309
|
+
<HStack>
|
|
310
|
+
<VStack gap="800px">
|
|
311
|
+
<Bookmark id="no-lvl" title="No level section">
|
|
312
|
+
no level section content
|
|
313
|
+
</Bookmark>
|
|
314
|
+
<Bookmark id="main" title="Main Section" level="{1}">
|
|
315
|
+
main section content
|
|
316
|
+
</Bookmark>
|
|
317
|
+
<Bookmark id="sub" title="Subsection" level="{2}">
|
|
318
|
+
subsection content
|
|
319
|
+
</Bookmark>
|
|
320
|
+
bottom of the page text
|
|
321
|
+
</VStack>
|
|
322
|
+
<TableOfContents omitH1="{true}" />
|
|
323
|
+
</HStack>
|
|
324
|
+
</Page>
|
|
325
|
+
`);
|
|
326
|
+
yield (0, fixtures_1.expect)(page.getByRole("link", { name: "No level section" })).not.toBeVisible();
|
|
327
|
+
yield (0, fixtures_1.expect)(page.getByRole("link", { name: "Main Section" })).not.toBeVisible();
|
|
328
|
+
yield (0, fixtures_1.expect)(page.getByRole("link", { name: "Subsection" })).toBeVisible();
|
|
329
|
+
}));
|
|
330
|
+
});
|
|
331
|
+
fixtures_1.test.describe("smoothScrolling property", () => {
|
|
332
|
+
(0, fixtures_1.test)("applies smooth scrolling when enabled", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
333
|
+
yield page.setViewportSize({ height: 600, width: 800 });
|
|
334
|
+
yield initTestBed(`
|
|
335
|
+
<Page>
|
|
336
|
+
<HStack>
|
|
337
|
+
<VStack gap="800px">
|
|
338
|
+
<Heading level="h2" value="Smooth Section" />
|
|
339
|
+
<Heading level="h2" value="Another Section" />
|
|
340
|
+
bottom of the page text
|
|
341
|
+
</VStack>
|
|
342
|
+
<TableOfContents smoothScrolling="{true}" />
|
|
343
|
+
</HStack>
|
|
344
|
+
</Page>
|
|
345
|
+
`);
|
|
346
|
+
const secondHeading = page.getByRole("heading", { name: "Another Section" });
|
|
347
|
+
const link = page.getByRole("link", { name: "Another Section" });
|
|
348
|
+
yield link.click();
|
|
349
|
+
yield (0, fixtures_1.expect)(secondHeading).toBeInViewport();
|
|
350
|
+
}));
|
|
351
|
+
(0, fixtures_1.test)("works without smooth scrolling when disabled", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
352
|
+
yield page.setViewportSize({ height: 600, width: 800 });
|
|
353
|
+
yield initTestBed(`
|
|
354
|
+
<Page>
|
|
355
|
+
<HStack>
|
|
356
|
+
<VStack gap="800px">
|
|
357
|
+
<Heading level="h2" value="Regular Section" />
|
|
358
|
+
<Heading level="h2" value="Another Section" />
|
|
359
|
+
bottom of the page text
|
|
360
|
+
</VStack>
|
|
361
|
+
<TableOfContents smoothScrolling="{false}" />
|
|
362
|
+
</HStack>
|
|
363
|
+
</Page>
|
|
364
|
+
`);
|
|
365
|
+
const secondHeading = page.getByRole("heading", { name: "Another Section" });
|
|
366
|
+
const link = page.getByRole("link", { name: "Another Section" });
|
|
367
|
+
yield link.click();
|
|
368
|
+
yield (0, fixtures_1.expect)(secondHeading).toBeInViewport();
|
|
369
|
+
}));
|
|
370
|
+
});
|
|
371
|
+
// =============================================================================
|
|
372
|
+
// ID PROPERTY TESTS
|
|
373
|
+
// =============================================================================
|
|
374
|
+
});
|
|
375
|
+
// =============================================================================
|
|
376
|
+
// ACCESSIBILITY TESTS
|
|
377
|
+
// =============================================================================
|
|
378
|
+
fixtures_1.test.describe("Accessibility", () => {
|
|
379
|
+
(0, fixtures_1.test)("supports keyboard navigation", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
380
|
+
yield page.setViewportSize({ height: 600, width: 800 });
|
|
381
|
+
yield initTestBed(`
|
|
382
|
+
<Page>
|
|
383
|
+
<HStack>
|
|
384
|
+
<VStack gap="800px">
|
|
385
|
+
<Heading level="h2" value="First Section" />
|
|
386
|
+
<Heading level="h2" value="Second Section" />
|
|
387
|
+
bottom of the page text
|
|
388
|
+
</VStack>
|
|
389
|
+
<TableOfContents />
|
|
390
|
+
</HStack>
|
|
391
|
+
</Page>
|
|
392
|
+
`);
|
|
393
|
+
const nav = page.getByRole("navigation");
|
|
394
|
+
yield nav.focus();
|
|
395
|
+
// Tab to first link
|
|
396
|
+
yield page.keyboard.press("Tab");
|
|
397
|
+
const firstLink = page.getByRole("link", { name: "First Section" });
|
|
398
|
+
yield (0, fixtures_1.expect)(firstLink).toBeFocused();
|
|
399
|
+
// Tab to second link
|
|
400
|
+
yield page.keyboard.press("Tab");
|
|
401
|
+
const secondLink = page.getByRole("link", { name: "Second Section" });
|
|
402
|
+
yield (0, fixtures_1.expect)(secondLink).toBeFocused();
|
|
403
|
+
// Enter should activate the link
|
|
404
|
+
const secondHeading = page.getByRole("heading", { name: "Second Section" });
|
|
405
|
+
yield page.keyboard.press("Enter");
|
|
406
|
+
yield (0, fixtures_1.expect)(secondHeading).toBeInViewport();
|
|
407
|
+
}));
|
|
408
|
+
});
|
|
409
|
+
// =============================================================================
|
|
410
|
+
// THEME VARIABLES TESTS
|
|
411
|
+
// =============================================================================
|
|
412
|
+
fixtures_1.test.describe("Theme Variables", () => {
|
|
413
|
+
(0, fixtures_1.test)("applies container theme variables", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
414
|
+
yield page.setViewportSize({ height: 600, width: 800 });
|
|
415
|
+
yield initTestBed(`
|
|
416
|
+
<Page>
|
|
417
|
+
<HStack>
|
|
418
|
+
<VStack>
|
|
419
|
+
<Heading level="h1" value="Test Heading" />
|
|
420
|
+
bottom of the page text
|
|
421
|
+
</VStack>
|
|
422
|
+
<TableOfContents />
|
|
423
|
+
</HStack>
|
|
424
|
+
</Page>
|
|
425
|
+
`, {
|
|
426
|
+
testThemeVars: {
|
|
427
|
+
"backgroundColor-TableOfContents": "rgb(255, 0, 0)",
|
|
428
|
+
"width-TableOfContents": "300px",
|
|
429
|
+
"height-TableOfContents": "400px",
|
|
430
|
+
"padding-TableOfContents": "20px",
|
|
431
|
+
"borderWidth-TableOfContents": "2px",
|
|
432
|
+
"borderColor-TableOfContents": "rgb(0, 255, 0)",
|
|
433
|
+
"borderStyle-TableOfContents": "solid",
|
|
434
|
+
},
|
|
435
|
+
});
|
|
436
|
+
const tocContainer = page.getByRole("navigation");
|
|
437
|
+
yield Promise.all([
|
|
438
|
+
(0, fixtures_1.expect)(tocContainer).toHaveCSS("background-color", "rgb(255, 0, 0)"),
|
|
439
|
+
(0, fixtures_1.expect)(tocContainer).toHaveCSS("width", "300px"),
|
|
440
|
+
(0, fixtures_1.expect)(tocContainer).toHaveCSS("height", "400px"),
|
|
441
|
+
(0, fixtures_1.expect)(tocContainer).toHaveCSS("padding", "20px"),
|
|
442
|
+
(0, fixtures_1.expect)(tocContainer).toHaveCSS("border-width", "2px"),
|
|
443
|
+
(0, fixtures_1.expect)(tocContainer).toHaveCSS("border-color", "rgb(0, 255, 0)"),
|
|
444
|
+
(0, fixtures_1.expect)(tocContainer).toHaveCSS("border-style", "solid"),
|
|
445
|
+
]);
|
|
446
|
+
}));
|
|
447
|
+
(0, fixtures_1.test)("applies item base theme variables", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
448
|
+
yield page.setViewportSize({ height: 600, width: 800 });
|
|
449
|
+
yield initTestBed(`
|
|
450
|
+
<Page>
|
|
451
|
+
<HStack>
|
|
452
|
+
<VStack>
|
|
453
|
+
<Heading level="h2" value="Test Heading" />
|
|
454
|
+
bottom of the page text
|
|
455
|
+
</VStack>
|
|
456
|
+
<TableOfContents />
|
|
457
|
+
</HStack>
|
|
458
|
+
</Page>
|
|
459
|
+
`, {
|
|
460
|
+
testThemeVars: {
|
|
461
|
+
"textColor-TableOfContentsItem": "rgb(255, 0, 0)",
|
|
462
|
+
"fontSize-TableOfContentsItem": "18px",
|
|
463
|
+
"fontWeight-TableOfContentsItem": "700",
|
|
464
|
+
"padding-TableOfContentsItem": "25px",
|
|
465
|
+
//This theme var below should not be needed, but currently is
|
|
466
|
+
"padding-TableOfContentsItem-level-2": "25px",
|
|
467
|
+
},
|
|
468
|
+
});
|
|
469
|
+
const tocLink = page.getByRole("link", { name: "Test Heading" });
|
|
470
|
+
yield Promise.all([
|
|
471
|
+
(0, fixtures_1.expect)(tocLink).toHaveCSS("color", "rgb(255, 0, 0)"),
|
|
472
|
+
(0, fixtures_1.expect)(tocLink).toHaveCSS("font-size", "18px"),
|
|
473
|
+
(0, fixtures_1.expect)(tocLink).toHaveCSS("font-weight", "700"),
|
|
474
|
+
(0, fixtures_1.expect)(tocLink).toHaveCSS("padding", "25px"),
|
|
475
|
+
]);
|
|
476
|
+
}));
|
|
477
|
+
(0, fixtures_1.test)("applies level-specific theme variables for H1", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
478
|
+
yield initTestBed(`
|
|
479
|
+
<Page>
|
|
480
|
+
<HStack>
|
|
481
|
+
<VStack>
|
|
482
|
+
<Heading level="h1" value="Level 1 Heading" />
|
|
483
|
+
<Heading level="h1" value="Active Heading " />
|
|
484
|
+
</VStack>
|
|
485
|
+
<TableOfContents />
|
|
486
|
+
</HStack>
|
|
487
|
+
</Page>
|
|
488
|
+
`, {
|
|
489
|
+
testThemeVars: {
|
|
490
|
+
"padding-TableOfContentsItem-level-1": "25px",
|
|
491
|
+
"fontSize-TableOfContentsItem-level-1": "22px",
|
|
492
|
+
"fontWeight-TableOfContentsItem-level-1": "800",
|
|
493
|
+
"textColor-TableOfContentsItem-level-1": "rgb(0, 0, 255)",
|
|
494
|
+
},
|
|
495
|
+
});
|
|
496
|
+
const h1Link = page.getByRole("link", { name: "Level 1 Heading" });
|
|
497
|
+
yield Promise.all([
|
|
498
|
+
(0, fixtures_1.expect)(h1Link).toHaveCSS("padding", "25px"),
|
|
499
|
+
(0, fixtures_1.expect)(h1Link).toHaveCSS("font-size", "22px"),
|
|
500
|
+
(0, fixtures_1.expect)(h1Link).toHaveCSS("font-weight", "800"),
|
|
501
|
+
(0, fixtures_1.expect)(h1Link).toHaveCSS("color", "rgb(0, 0, 255)"),
|
|
502
|
+
]);
|
|
503
|
+
}));
|
|
504
|
+
(0, fixtures_1.test)("applies level-specific theme variables for H2", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
505
|
+
yield initTestBed(`
|
|
506
|
+
<Page>
|
|
507
|
+
<HStack>
|
|
508
|
+
<VStack>
|
|
509
|
+
<Heading level="h2" value="Level 2 Heading" />
|
|
510
|
+
<Heading level="h2" value="Active heading" />
|
|
511
|
+
</VStack>
|
|
512
|
+
<TableOfContents />
|
|
513
|
+
</HStack>
|
|
514
|
+
</Page>
|
|
515
|
+
`, {
|
|
516
|
+
testThemeVars: {
|
|
517
|
+
"padding-TableOfContentsItem-level-2": "20px",
|
|
518
|
+
"fontSize-TableOfContentsItem-level-2": "20px",
|
|
519
|
+
"fontWeight-TableOfContentsItem-level-2": "600",
|
|
520
|
+
"textColor-TableOfContentsItem-level-2": "rgb(255, 255, 0)",
|
|
521
|
+
},
|
|
522
|
+
});
|
|
523
|
+
const h2Link = page.getByRole("link", { name: "Level 2 Heading" });
|
|
524
|
+
yield Promise.all([
|
|
525
|
+
(0, fixtures_1.expect)(h2Link).toHaveCSS("padding", "20px"),
|
|
526
|
+
(0, fixtures_1.expect)(h2Link).toHaveCSS("font-size", "20px"),
|
|
527
|
+
(0, fixtures_1.expect)(h2Link).toHaveCSS("font-weight", "600"),
|
|
528
|
+
(0, fixtures_1.expect)(h2Link).toHaveCSS("color", "rgb(255, 255, 0)"),
|
|
529
|
+
]);
|
|
530
|
+
}));
|
|
531
|
+
(0, fixtures_1.test)("applies level-specific theme variables for H6", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
532
|
+
yield initTestBed(`
|
|
533
|
+
<Page>
|
|
534
|
+
<HStack>
|
|
535
|
+
<VStack>
|
|
536
|
+
<Heading level="h6" value="Level 6 Heading" />
|
|
537
|
+
bottom of the page text
|
|
538
|
+
</VStack>
|
|
539
|
+
<TableOfContents />
|
|
540
|
+
</HStack>
|
|
541
|
+
</Page>
|
|
542
|
+
`, {
|
|
543
|
+
testThemeVars: {
|
|
544
|
+
"padding-TableOfContentsItem-level-6": "8px",
|
|
545
|
+
"fontSize-TableOfContentsItem-level-6": "12px",
|
|
546
|
+
"fontWeight-TableOfContentsItem-level-6": "400",
|
|
547
|
+
"fontStyle-TableOfContentsItem-level-6": "italic",
|
|
548
|
+
},
|
|
549
|
+
});
|
|
550
|
+
const h6Link = page.getByRole("link", { name: "Level 6 Heading" });
|
|
551
|
+
yield Promise.all([
|
|
552
|
+
(0, fixtures_1.expect)(h6Link).toHaveCSS("padding", "8px"),
|
|
553
|
+
(0, fixtures_1.expect)(h6Link).toHaveCSS("font-size", "12px"),
|
|
554
|
+
(0, fixtures_1.expect)(h6Link).toHaveCSS("font-weight", "400"),
|
|
555
|
+
(0, fixtures_1.expect)(h6Link).toHaveCSS("font-style", "italic"),
|
|
556
|
+
]);
|
|
557
|
+
}));
|
|
558
|
+
(0, fixtures_1.test)("applies hover state theme variables", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
559
|
+
yield page.setViewportSize({ height: 600, width: 800 });
|
|
560
|
+
yield initTestBed(`
|
|
561
|
+
<Page>
|
|
562
|
+
<HStack>
|
|
563
|
+
<VStack>
|
|
564
|
+
<Heading level="h2" value="First Heading" />
|
|
565
|
+
<Heading level="h2" value="Hover Test" />
|
|
566
|
+
bottom of the page text
|
|
567
|
+
</VStack>
|
|
568
|
+
<TableOfContents />
|
|
569
|
+
</HStack>
|
|
570
|
+
</Page>
|
|
571
|
+
`, {
|
|
572
|
+
testThemeVars: {
|
|
573
|
+
"backgroundColor-TableOfContentsItem--hover": "rgb(200, 200, 200)",
|
|
574
|
+
"textColor-TableOfContentsItem--hover": "rgb(100, 100, 100)",
|
|
575
|
+
"fontWeight-TableOfContentsItem--hover": "900",
|
|
576
|
+
},
|
|
577
|
+
});
|
|
578
|
+
// First click on the second heading to make it active
|
|
579
|
+
const secondHeading = page.getByRole("link", { name: "Hover Test" });
|
|
580
|
+
yield secondHeading.click();
|
|
581
|
+
// Now hover over the first heading (which should not be active)
|
|
582
|
+
const firstHeading = page.getByRole("link", { name: "First Heading" });
|
|
583
|
+
const listItem = firstHeading.locator("..");
|
|
584
|
+
yield firstHeading.hover();
|
|
585
|
+
yield Promise.all([
|
|
586
|
+
(0, fixtures_1.expect)(listItem).toHaveCSS("background-color", "rgb(200, 200, 200)"),
|
|
587
|
+
(0, fixtures_1.expect)(firstHeading).toHaveCSS("color", "rgb(100, 100, 100)"),
|
|
588
|
+
(0, fixtures_1.expect)(firstHeading).toHaveCSS("font-weight", "900"),
|
|
589
|
+
]);
|
|
590
|
+
}));
|
|
591
|
+
(0, fixtures_1.test)("applies active state theme variables", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
592
|
+
yield page.setViewportSize({ height: 600, width: 800 });
|
|
593
|
+
yield initTestBed(`
|
|
594
|
+
<Page>
|
|
595
|
+
<HStack>
|
|
596
|
+
<VStack>
|
|
597
|
+
<Heading level="h2" value="Active Test" />
|
|
598
|
+
<Heading level="h3" value="Another Section" />
|
|
599
|
+
bottom of the page text
|
|
600
|
+
</VStack>
|
|
601
|
+
<TableOfContents />
|
|
602
|
+
</HStack>
|
|
603
|
+
</Page>
|
|
604
|
+
`, {
|
|
605
|
+
testThemeVars: {
|
|
606
|
+
"backgroundColor-TableOfContentsItem--active": "rgb(150, 150, 255)",
|
|
607
|
+
"textColor-TableOfContentsItem--active": "rgb(50, 50, 150)",
|
|
608
|
+
"fontWeight-TableOfContentsItem--active": "bold",
|
|
609
|
+
},
|
|
610
|
+
});
|
|
611
|
+
const activeLink = page.getByRole("link", { name: "Another Section" });
|
|
612
|
+
yield activeLink.click();
|
|
613
|
+
const activeListItem = page.locator("[class*='active']").first();
|
|
614
|
+
const activeLinkElement = activeListItem.getByRole("link");
|
|
615
|
+
yield Promise.all([
|
|
616
|
+
(0, fixtures_1.expect)(activeListItem).toHaveCSS("background-color", "rgb(150, 150, 255)"),
|
|
617
|
+
(0, fixtures_1.expect)(activeLinkElement).toHaveCSS("color", "rgb(50, 50, 150)"),
|
|
618
|
+
(0, fixtures_1.expect)(activeLinkElement).toHaveCSS("font-weight", "700"), // 'bold' maps to 700
|
|
619
|
+
]);
|
|
620
|
+
}));
|
|
621
|
+
});
|
|
622
|
+
// =============================================================================
|
|
623
|
+
// OTHER EDGE CASE TESTS
|
|
624
|
+
// =============================================================================
|
|
625
|
+
fixtures_1.test.describe("Other Edge Cases", () => {
|
|
626
|
+
fixtures_1.test.describe("id property handling", () => {
|
|
627
|
+
(0, fixtures_1.test)("handles unicode characters in heading titles", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
628
|
+
yield page.setViewportSize({ height: 600, width: 800 });
|
|
629
|
+
yield initTestBed(`
|
|
630
|
+
<Page>
|
|
631
|
+
<HStack>
|
|
632
|
+
<VStack gap="800px">
|
|
633
|
+
top of the page text
|
|
634
|
+
<Heading level="h2" value="测试标题-émojis🚀" />
|
|
635
|
+
bottom of the page text
|
|
636
|
+
</VStack>
|
|
637
|
+
<TableOfContents />
|
|
638
|
+
</HStack>
|
|
639
|
+
</Page>
|
|
640
|
+
`);
|
|
641
|
+
const unicodeHeading = page.getByRole("heading", { name: "测试标题-émojis🚀" });
|
|
642
|
+
const unicodeLink = page.getByRole("link", { name: "测试标题-émojis🚀" });
|
|
643
|
+
yield (0, fixtures_1.expect)(unicodeLink).toBeVisible();
|
|
644
|
+
yield unicodeLink.click();
|
|
645
|
+
yield (0, fixtures_1.expect)(unicodeHeading).toBeInViewport();
|
|
646
|
+
}));
|
|
647
|
+
(0, fixtures_1.test)("handles bookmarks with special characters", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
648
|
+
yield page.setViewportSize({ height: 600, width: 800 });
|
|
649
|
+
yield initTestBed(`
|
|
650
|
+
<Page>
|
|
651
|
+
<HStack>
|
|
652
|
+
<VStack gap="800px">
|
|
653
|
+
top of the page text
|
|
654
|
+
<Bookmark id="special-bookmark_test section" title="Special Bookmark" level="{2}">
|
|
655
|
+
special bookmark content
|
|
656
|
+
</Bookmark>
|
|
657
|
+
bottom of the page text
|
|
658
|
+
</VStack>
|
|
659
|
+
<TableOfContents />
|
|
660
|
+
</HStack>
|
|
661
|
+
</Page>
|
|
662
|
+
`);
|
|
663
|
+
const bookmarkContent = page.getByText("special bookmark content");
|
|
664
|
+
const bookmarkLink = page.getByRole("link", { name: "Special Bookmark" });
|
|
665
|
+
yield (0, fixtures_1.expect)(bookmarkLink).toBeVisible();
|
|
666
|
+
yield bookmarkLink.click();
|
|
667
|
+
yield (0, fixtures_1.expect)(bookmarkContent).toBeInViewport();
|
|
668
|
+
yield page.waitForURL(/#special-bookmark_test(%20| )section$/);
|
|
669
|
+
}));
|
|
670
|
+
});
|
|
671
|
+
(0, fixtures_1.test)("handles no headings or bookmarks gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
672
|
+
yield page.setViewportSize({ height: 600, width: 800 });
|
|
673
|
+
yield initTestBed(`
|
|
674
|
+
<Page>
|
|
675
|
+
<HStack>
|
|
676
|
+
<VStack gap="800px">
|
|
677
|
+
<Text>Just some text content</Text>
|
|
678
|
+
bottom of the page text
|
|
679
|
+
</VStack>
|
|
680
|
+
<TableOfContents />
|
|
681
|
+
</HStack>
|
|
682
|
+
</Page>
|
|
683
|
+
`);
|
|
684
|
+
const tocContainer = page.getByRole("link");
|
|
685
|
+
yield (0, fixtures_1.expect)(tocContainer).not.toBeVisible();
|
|
686
|
+
}));
|
|
687
|
+
(0, fixtures_1.test)("handles null props gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
688
|
+
yield page.setViewportSize({ height: 600, width: 800 });
|
|
689
|
+
yield initTestBed(`
|
|
690
|
+
<Page>
|
|
691
|
+
<HStack>
|
|
692
|
+
<VStack gap="800px">
|
|
693
|
+
top of the page text
|
|
694
|
+
<Heading level="h2" value="Test Heading" />
|
|
695
|
+
bottom of the page text
|
|
696
|
+
</VStack>
|
|
697
|
+
<TableOfContents maxHeadingLevel="{null}" omitH1="{null}" smoothScrolling="{null}" />
|
|
698
|
+
</HStack>
|
|
699
|
+
</Page>
|
|
700
|
+
`);
|
|
701
|
+
const testHeading = page.getByRole("heading", { name: "Test Heading" });
|
|
702
|
+
const testLink = page.getByRole("link", { name: "Test Heading" });
|
|
703
|
+
yield (0, fixtures_1.expect)(testLink).toBeVisible();
|
|
704
|
+
yield testLink.click();
|
|
705
|
+
yield (0, fixtures_1.expect)(testHeading).toBeInViewport();
|
|
706
|
+
}));
|
|
707
|
+
(0, fixtures_1.test)("handles undefined props gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
708
|
+
yield page.setViewportSize({ height: 600, width: 800 });
|
|
709
|
+
yield initTestBed(`
|
|
710
|
+
<Page>
|
|
711
|
+
<HStack>
|
|
712
|
+
<VStack gap="800px">
|
|
713
|
+
<Heading level="h1" value="Test H1" />
|
|
714
|
+
<Heading level="h2" value="Test H2" />
|
|
715
|
+
bottom of the page text
|
|
716
|
+
</VStack>
|
|
717
|
+
<TableOfContents maxHeadingLevel="{undefined}" omitH1="{undefined}" smoothScrolling="{undefined}" />
|
|
718
|
+
</HStack>
|
|
719
|
+
</Page>
|
|
720
|
+
`);
|
|
721
|
+
yield (0, fixtures_1.expect)(page.getByRole("link", { name: "Test H1" })).toBeVisible();
|
|
722
|
+
yield (0, fixtures_1.expect)(page.getByRole("link", { name: "Test H2" })).toBeVisible();
|
|
723
|
+
}));
|
|
724
|
+
});
|
|
725
|
+
fixtures_1.test.describe("Interactions with Bookmark props", () => {
|
|
726
|
+
(0, fixtures_1.test)("uses bookmark title fallback when title and content is empty", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, }) {
|
|
727
|
+
yield initTestBed(`
|
|
728
|
+
<Page>
|
|
729
|
+
<HStack>
|
|
730
|
+
<VStack gap="800px">
|
|
731
|
+
<Bookmark id="fallback-test" title=""/>
|
|
732
|
+
</VStack>
|
|
733
|
+
<TableOfContents />
|
|
734
|
+
</HStack>
|
|
735
|
+
</Page>
|
|
736
|
+
`);
|
|
737
|
+
const tocItem = page.getByRole("link", { name: "fallback-test" });
|
|
738
|
+
yield (0, fixtures_1.expect)(tocItem).toBeVisible();
|
|
739
|
+
}));
|
|
740
|
+
(0, fixtures_1.test)("uses bookmark id as fallback when both title and content are empty", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, }) {
|
|
741
|
+
yield initTestBed(`
|
|
742
|
+
<Page>
|
|
743
|
+
<HStack>
|
|
744
|
+
<VStack gap="800px">
|
|
745
|
+
<Bookmark id="id-fallback" title="" />
|
|
746
|
+
</VStack>
|
|
747
|
+
<TableOfContents />
|
|
748
|
+
</HStack>
|
|
749
|
+
</Page>
|
|
750
|
+
`);
|
|
751
|
+
const tocItem = page.getByRole("link", { name: "id-fallback" });
|
|
752
|
+
yield (0, fixtures_1.expect)(tocItem).toBeVisible();
|
|
753
|
+
}));
|
|
754
|
+
(0, fixtures_1.test)("excludes bookmarks with omitFromToc=true", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
755
|
+
yield initTestBed(`
|
|
756
|
+
<Page>
|
|
757
|
+
<HStack>
|
|
758
|
+
<VStack gap="800px">
|
|
759
|
+
<Bookmark id="visible" title="Visible Bookmark">
|
|
760
|
+
visible content
|
|
761
|
+
</Bookmark>
|
|
762
|
+
<Bookmark id="hidden" title="Hidden Bookmark" omitFromToc="{true}">
|
|
763
|
+
hidden content
|
|
764
|
+
</Bookmark>
|
|
765
|
+
<Bookmark id="also-visible" title="Also Visible">
|
|
766
|
+
also visible content
|
|
767
|
+
</Bookmark>
|
|
768
|
+
</VStack>
|
|
769
|
+
<TableOfContents />
|
|
770
|
+
</HStack>
|
|
771
|
+
</Page>
|
|
772
|
+
`);
|
|
773
|
+
const visibleItem = page.getByRole("link", { name: "Visible Bookmark" });
|
|
774
|
+
const hiddenItem = page.getByRole("link", { name: "Hidden Bookmark" });
|
|
775
|
+
const alsoVisibleItem = page.getByRole("link", { name: "Also Visible" });
|
|
776
|
+
yield (0, fixtures_1.expect)(visibleItem).toBeVisible();
|
|
777
|
+
yield (0, fixtures_1.expect)(hiddenItem).not.toBeVisible();
|
|
778
|
+
yield (0, fixtures_1.expect)(alsoVisibleItem).toBeVisible();
|
|
779
|
+
}));
|
|
780
|
+
(0, fixtures_1.test)("handles bookmarks without id gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
781
|
+
yield initTestBed(`
|
|
782
|
+
<Page>
|
|
783
|
+
<HStack>
|
|
784
|
+
<VStack gap="800px">
|
|
785
|
+
<Bookmark title="No ID Bookmark">
|
|
786
|
+
content without id
|
|
787
|
+
</Bookmark>
|
|
788
|
+
<Bookmark id="with-id" title="With ID">
|
|
789
|
+
content with id
|
|
790
|
+
</Bookmark>
|
|
791
|
+
</VStack>
|
|
792
|
+
<TableOfContents />
|
|
793
|
+
</HStack>
|
|
794
|
+
</Page>
|
|
795
|
+
`);
|
|
796
|
+
const noIdItem = page.getByRole("link", { name: "No ID Bookmark" });
|
|
797
|
+
const withIdItem = page.getByRole("link", { name: "With ID" });
|
|
798
|
+
yield (0, fixtures_1.expect)(noIdItem).not.toBeVisible();
|
|
799
|
+
yield (0, fixtures_1.expect)(withIdItem).toBeVisible();
|
|
800
|
+
}));
|
|
801
|
+
(0, fixtures_1.test)("respects bookmark level in omitH1 filtering", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
802
|
+
yield initTestBed(`
|
|
803
|
+
<Page>
|
|
804
|
+
<HStack>
|
|
805
|
+
<VStack gap="800px">
|
|
806
|
+
<Bookmark id="level1" title="Level 1 Bookmark" level="{1}">
|
|
807
|
+
level 1 content
|
|
808
|
+
</Bookmark>
|
|
809
|
+
<Bookmark id="level2" title="Level 2 Bookmark" level="{2}">
|
|
810
|
+
level 2 content
|
|
811
|
+
</Bookmark>
|
|
812
|
+
</VStack>
|
|
813
|
+
<TableOfContents omitH1="{true}" />
|
|
814
|
+
</HStack>
|
|
815
|
+
</Page>
|
|
816
|
+
`);
|
|
817
|
+
const level1Item = page.getByRole("link", { name: "Level 1 Bookmark" });
|
|
818
|
+
const level2Item = page.getByRole("link", { name: "Level 2 Bookmark" });
|
|
819
|
+
yield (0, fixtures_1.expect)(level1Item).not.toBeVisible();
|
|
820
|
+
yield (0, fixtures_1.expect)(level2Item).toBeVisible();
|
|
821
|
+
}));
|
|
822
|
+
(0, fixtures_1.test)("uses content text as title over id when title is undefined", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, }) {
|
|
823
|
+
yield initTestBed(`
|
|
824
|
+
<Page>
|
|
825
|
+
<HStack>
|
|
826
|
+
<VStack gap="800px">
|
|
827
|
+
<Bookmark id="content-text">
|
|
828
|
+
Content as title text
|
|
829
|
+
</Bookmark>
|
|
830
|
+
</VStack>
|
|
831
|
+
<TableOfContents />
|
|
832
|
+
</HStack>
|
|
833
|
+
</Page>
|
|
834
|
+
`);
|
|
835
|
+
const tocItem = page.getByRole("link", { name: "Content as title text" });
|
|
836
|
+
yield (0, fixtures_1.expect)(tocItem).toBeVisible();
|
|
837
|
+
}));
|
|
838
|
+
});
|