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,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const data = [
|
|
4
|
+
{
|
|
5
|
+
id: 0,
|
|
6
|
+
name: "Apples",
|
|
7
|
+
quantity: 5,
|
|
8
|
+
unit: "pieces",
|
|
9
|
+
category: "fruits",
|
|
10
|
+
key: 5,
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
id: 1,
|
|
14
|
+
name: "Bananas",
|
|
15
|
+
quantity: 6,
|
|
16
|
+
unit: "pieces",
|
|
17
|
+
category: "fruits",
|
|
18
|
+
key: 4,
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
id: 2,
|
|
22
|
+
name: "Carrots",
|
|
23
|
+
quantity: 100,
|
|
24
|
+
unit: "grams",
|
|
25
|
+
category: "vegetables",
|
|
26
|
+
key: 3,
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
id: 3,
|
|
30
|
+
name: "Spinach",
|
|
31
|
+
quantity: 1,
|
|
32
|
+
unit: "bunch",
|
|
33
|
+
category: "vegetables",
|
|
34
|
+
key: 2,
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
id: 4,
|
|
38
|
+
name: "Milk",
|
|
39
|
+
quantity: 10,
|
|
40
|
+
unit: "liter",
|
|
41
|
+
category: "dairy",
|
|
42
|
+
key: 1,
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
id: 5,
|
|
46
|
+
name: "Cheese",
|
|
47
|
+
quantity: 200,
|
|
48
|
+
unit: "grams",
|
|
49
|
+
category: "dairy",
|
|
50
|
+
key: 0,
|
|
51
|
+
},
|
|
52
|
+
];
|
|
53
|
+
exports.default = data;
|
|
@@ -0,0 +1,188 @@
|
|
|
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
|
+
// --- Testing
|
|
14
|
+
fixtures_1.test.describe("smoke tests", { tag: "@smoke" }, () => {
|
|
15
|
+
(0, fixtures_1.test)("Markdown renders", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createMarkdownDriver }) {
|
|
16
|
+
yield initTestBed(`<Markdown />`);
|
|
17
|
+
yield (0, fixtures_1.expect)((yield createMarkdownDriver()).component).toBeAttached();
|
|
18
|
+
}));
|
|
19
|
+
(0, fixtures_1.test)("handles empty binding expression", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createMarkdownDriver }) {
|
|
20
|
+
yield initTestBed(`<Markdown><![CDATA[\@{}]]></Markdown>`);
|
|
21
|
+
yield (0, fixtures_1.expect)((yield createMarkdownDriver()).component).toHaveText("");
|
|
22
|
+
}));
|
|
23
|
+
(0, fixtures_1.test)("does not detect escaped empty expression #1", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createMarkdownDriver, }) {
|
|
24
|
+
yield initTestBed(`<Markdown><![CDATA[\\@{}]]></Markdown>`);
|
|
25
|
+
yield (0, fixtures_1.expect)((yield createMarkdownDriver()).component).toHaveText("@{}");
|
|
26
|
+
}));
|
|
27
|
+
(0, fixtures_1.test)("does not detect escaped empty expression #2", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createMarkdownDriver, }) {
|
|
28
|
+
yield initTestBed(`<Markdown><![CDATA[\@\\{}]]></Markdown>`);
|
|
29
|
+
yield (0, fixtures_1.expect)((yield createMarkdownDriver()).component).toHaveText("@{}");
|
|
30
|
+
}));
|
|
31
|
+
(0, fixtures_1.test)("does not detect escaped expression #1", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createMarkdownDriver }) {
|
|
32
|
+
yield initTestBed(`<Markdown><![CDATA[\\@{1}]]></Markdown>`);
|
|
33
|
+
yield (0, fixtures_1.expect)((yield createMarkdownDriver()).component).toHaveText("@{1}");
|
|
34
|
+
}));
|
|
35
|
+
(0, fixtures_1.test)("does not detect escaped expression #2", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createMarkdownDriver }) {
|
|
36
|
+
yield initTestBed(`<Markdown><![CDATA[\@\\{1}]]></Markdown>`);
|
|
37
|
+
yield (0, fixtures_1.expect)((yield createMarkdownDriver()).component).toHaveText("@{1}");
|
|
38
|
+
}));
|
|
39
|
+
(0, fixtures_1.test)("handles only spaces binding expression", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createMarkdownDriver }) {
|
|
40
|
+
yield initTestBed(`<Markdown><![CDATA[\@{ }]]></Markdown>`);
|
|
41
|
+
yield (0, fixtures_1.expect)((yield createMarkdownDriver()).component).toHaveText("");
|
|
42
|
+
}));
|
|
43
|
+
(0, fixtures_1.test)("handles binding expression", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createMarkdownDriver }) {
|
|
44
|
+
yield initTestBed(`<Markdown><![CDATA[\@{1+1}]]></Markdown>`);
|
|
45
|
+
yield (0, fixtures_1.expect)((yield createMarkdownDriver()).component).toHaveText("2");
|
|
46
|
+
}));
|
|
47
|
+
(0, fixtures_1.test)("handles objects in binding expressions", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createMarkdownDriver }) {
|
|
48
|
+
const expected = "{ a : 1, b: 'c' }";
|
|
49
|
+
yield initTestBed(`<Markdown><![CDATA[\@{${expected}}]]></Markdown>`);
|
|
50
|
+
yield (0, fixtures_1.expect)((yield createMarkdownDriver()).component).toHaveText(`{"a":1,"b":"c"}`);
|
|
51
|
+
}));
|
|
52
|
+
(0, fixtures_1.test)("handles arrays in binding expressions", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createMarkdownDriver }) {
|
|
53
|
+
const expected = "[ 1, 2, 3 ]";
|
|
54
|
+
yield initTestBed(`<Markdown><![CDATA[\@{${expected}}]]></Markdown>`);
|
|
55
|
+
yield (0, fixtures_1.expect)((yield createMarkdownDriver()).component).toHaveText(`[1,2,3]`);
|
|
56
|
+
}));
|
|
57
|
+
(0, fixtures_1.test)("handles functions in binding expressions", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createMarkdownDriver, }) {
|
|
58
|
+
const SOURCE = "() => { const x = 1; console.log(x); return null; }";
|
|
59
|
+
const EXPECTED = "[xmlui function]";
|
|
60
|
+
yield initTestBed(`<Markdown><![CDATA[\@{${SOURCE}}]]></Markdown>`);
|
|
61
|
+
yield (0, fixtures_1.expect)((yield createMarkdownDriver()).component).toHaveText(EXPECTED);
|
|
62
|
+
}));
|
|
63
|
+
(0, fixtures_1.test)("handles nested objects in binding expressions", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createMarkdownDriver, }) {
|
|
64
|
+
const expected = "{ a : 1, b: { c: 1 } }";
|
|
65
|
+
yield initTestBed(`<Markdown><![CDATA[\@{${expected}}]]></Markdown>`);
|
|
66
|
+
yield (0, fixtures_1.expect)((yield createMarkdownDriver()).component).toHaveText(`{"a":1,"b":{"c":1}}`);
|
|
67
|
+
}));
|
|
68
|
+
(0, fixtures_1.test)("handles functions nested in objects in binding expressions", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createMarkdownDriver, }) {
|
|
69
|
+
const SOURCE = "{ a: () => { const x = 1; console.log(x); return null; } }";
|
|
70
|
+
const EXPECTED = '{"a":"[xmlui function]"}';
|
|
71
|
+
yield initTestBed(`<Markdown><![CDATA[\@{${SOURCE}}]]></Markdown>`);
|
|
72
|
+
yield (0, fixtures_1.expect)((yield createMarkdownDriver()).component).toHaveText(EXPECTED);
|
|
73
|
+
}));
|
|
74
|
+
(0, fixtures_1.test)("handles arrays nested in objects in binding expressions", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createMarkdownDriver, }) {
|
|
75
|
+
const expected = "{ a: [1, 2, 3] }";
|
|
76
|
+
yield initTestBed(`<Markdown><![CDATA[\@{${expected}}]]></Markdown>`);
|
|
77
|
+
yield (0, fixtures_1.expect)((yield createMarkdownDriver()).component).toHaveText(`{"a":[1,2,3]}`);
|
|
78
|
+
}));
|
|
79
|
+
(0, fixtures_1.test)("handles arrays nested in functions in binding expressions", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createMarkdownDriver, }) {
|
|
80
|
+
const SOURCE = "() => { return [1, 2, 3]; }";
|
|
81
|
+
const EXPECTED = "[xmlui function]";
|
|
82
|
+
yield initTestBed(`<Markdown><![CDATA[\@{${SOURCE}}]]></Markdown>`);
|
|
83
|
+
yield (0, fixtures_1.expect)((yield createMarkdownDriver()).component).toHaveText(EXPECTED);
|
|
84
|
+
}));
|
|
85
|
+
(0, fixtures_1.test)("handles complex expressions", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createMarkdownDriver }) {
|
|
86
|
+
const SOURCE = "Hello there @{ {a : () => {}, x: null, b: { c: 3, d: 'asdadsda', e: () => {return null;} } } } How are you @{true || undefined || []}";
|
|
87
|
+
const EXPECTED = 'Hello there {"a":"[xmlui function]","x":null,"b":{"c":3,"d":"asdadsda","e":"[xmlui function]"}} How are you true';
|
|
88
|
+
yield initTestBed(`<Markdown><![CDATA[${SOURCE}]]></Markdown>`);
|
|
89
|
+
yield (0, fixtures_1.expect)((yield createMarkdownDriver()).component).toHaveText(EXPECTED);
|
|
90
|
+
}));
|
|
91
|
+
const headingLevelsWithMarkdown = [
|
|
92
|
+
{ level: "h1", md: "# Heading" },
|
|
93
|
+
{ level: "h2", md: "## Heading" },
|
|
94
|
+
{ level: "h3", md: "### Heading" },
|
|
95
|
+
{ level: "h4", md: "#### Heading" },
|
|
96
|
+
{ level: "h5", md: "##### Heading" },
|
|
97
|
+
{ level: "h6", md: "###### Heading" },
|
|
98
|
+
];
|
|
99
|
+
headingLevelsWithMarkdown.forEach(({ level, md }) => {
|
|
100
|
+
(0, fixtures_1.test)(`can render anchor link for '${level}'`, (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createMarkdownDriver }) {
|
|
101
|
+
const SOURCE = md;
|
|
102
|
+
yield initTestBed(`<Markdown showHeadingAnchors="true"><![CDATA[${SOURCE}]]></Markdown>`);
|
|
103
|
+
const driver = yield createMarkdownDriver();
|
|
104
|
+
(0, fixtures_1.expect)(yield driver.hasHtmlElement("a")).toBe(true);
|
|
105
|
+
}));
|
|
106
|
+
});
|
|
107
|
+
(0, fixtures_1.test)("show implicit anchor links", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createMarkdownDriver }) {
|
|
108
|
+
const SOURCE = "## Heading";
|
|
109
|
+
yield initTestBed(`<Markdown showHeadingAnchors="true"><![CDATA[${SOURCE}]]></Markdown>`);
|
|
110
|
+
const driver = yield createMarkdownDriver();
|
|
111
|
+
(0, fixtures_1.expect)(yield driver.hasHtmlElement("a")).toBe(true);
|
|
112
|
+
}));
|
|
113
|
+
(0, fixtures_1.test)("show explicit anchor links", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createMarkdownDriver }) {
|
|
114
|
+
const SOURCE = "## Heading [#heading]";
|
|
115
|
+
yield initTestBed(`<Markdown showHeadingAnchors="true"><![CDATA[${SOURCE}]]></Markdown>`);
|
|
116
|
+
const driver = yield createMarkdownDriver();
|
|
117
|
+
(0, fixtures_1.expect)(yield driver.hasHtmlElement("a")).toBe(true);
|
|
118
|
+
}));
|
|
119
|
+
(0, fixtures_1.test)("don't render implicit anchor links", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createMarkdownDriver }) {
|
|
120
|
+
const SOURCE = "## Heading";
|
|
121
|
+
yield initTestBed(`<Markdown showHeadingAnchors="false"><![CDATA[${SOURCE}]]></Markdown>`);
|
|
122
|
+
const driver = yield createMarkdownDriver();
|
|
123
|
+
(0, fixtures_1.expect)(yield driver.hasHtmlElement("a")).toBe(false);
|
|
124
|
+
}));
|
|
125
|
+
(0, fixtures_1.test)("don't render explicit anchor links", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createMarkdownDriver }) {
|
|
126
|
+
const SOURCE = "## Heading [#heading]";
|
|
127
|
+
yield initTestBed(`<Markdown showHeadingAnchors="false"><![CDATA[${SOURCE}]]></Markdown>`);
|
|
128
|
+
const driver = yield createMarkdownDriver();
|
|
129
|
+
(0, fixtures_1.expect)(yield driver.hasHtmlElement("a")).toBe(false);
|
|
130
|
+
}));
|
|
131
|
+
});
|
|
132
|
+
(0, fixtures_1.test)("only renders if children are strings", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createMarkdownDriver }) {
|
|
133
|
+
yield initTestBed(`
|
|
134
|
+
<Markdown>
|
|
135
|
+
<Button label="Hey!" />
|
|
136
|
+
</Markdown>
|
|
137
|
+
`);
|
|
138
|
+
// Check if page is empty (no text)
|
|
139
|
+
const driver = yield createMarkdownDriver();
|
|
140
|
+
yield (0, fixtures_1.expect)(driver.component).toHaveText("");
|
|
141
|
+
}));
|
|
142
|
+
(0, fixtures_1.test)("renders if children are provided through CDATA", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createMarkdownDriver }) {
|
|
143
|
+
yield initTestBed(`
|
|
144
|
+
<Markdown>
|
|
145
|
+
<![CDATA[Hello World!]]>
|
|
146
|
+
</Markdown>
|
|
147
|
+
`);
|
|
148
|
+
// Check if page is empty (no text)
|
|
149
|
+
const driver = yield createMarkdownDriver();
|
|
150
|
+
yield (0, fixtures_1.expect)(driver.component).toHaveText("Hello World!");
|
|
151
|
+
}));
|
|
152
|
+
(0, fixtures_1.test)("renders code block", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createMarkdownDriver }) {
|
|
153
|
+
const code = "```\n" + "I did not expect this\n" + "```";
|
|
154
|
+
yield initTestBed(`<Markdown><![CDATA[${code}]]></Markdown>`);
|
|
155
|
+
const driver = yield createMarkdownDriver();
|
|
156
|
+
yield (0, fixtures_1.expect)(driver.component).toHaveText("I did not expect this");
|
|
157
|
+
(0, fixtures_1.expect)(yield driver.hasHtmlElement(["pre", "code"])).toBeTruthy();
|
|
158
|
+
}));
|
|
159
|
+
(0, fixtures_1.test)("4space/1 tab indent is not code block by default", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createMarkdownDriver, }) {
|
|
160
|
+
// Note the formatting here: the line breaks and indentations are intentional
|
|
161
|
+
const code = `
|
|
162
|
+
_I did not expect this_
|
|
163
|
+
`;
|
|
164
|
+
yield initTestBed(`<Markdown><![CDATA[${code}]]></Markdown>`);
|
|
165
|
+
const driver = yield createMarkdownDriver();
|
|
166
|
+
yield (0, fixtures_1.expect)(driver.component).toHaveText("I did not expect this");
|
|
167
|
+
(0, fixtures_1.expect)(yield driver.hasHtmlElement("em")).toBeTruthy();
|
|
168
|
+
}));
|
|
169
|
+
(0, fixtures_1.test)("removeIndents=false: 4space/1 tab indent is accounted for", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createMarkdownDriver, }) {
|
|
170
|
+
// Note the formatting here: the lack of indentations is intentional
|
|
171
|
+
const code = `
|
|
172
|
+
_I did not expect this_
|
|
173
|
+
`;
|
|
174
|
+
yield initTestBed(`<Markdown removeIndents="false"><![CDATA[${code}]]></Markdown>`);
|
|
175
|
+
const driver = yield createMarkdownDriver();
|
|
176
|
+
yield (0, fixtures_1.expect)(driver.component).toHaveText("I did not expect this");
|
|
177
|
+
(0, fixtures_1.expect)(yield driver.hasHtmlElement("em")).toBeTruthy();
|
|
178
|
+
}));
|
|
179
|
+
(0, fixtures_1.test)("removeIndents=false: 4space/1 tab indent maps to a code block", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createMarkdownDriver, }) {
|
|
180
|
+
// Note the formatting here: the indentations are intentional
|
|
181
|
+
const code = `
|
|
182
|
+
_I did not expect this_
|
|
183
|
+
`;
|
|
184
|
+
yield initTestBed(`<Markdown removeIndents="false"><![CDATA[${code}]]></Markdown>`);
|
|
185
|
+
const driver = yield createMarkdownDriver();
|
|
186
|
+
yield (0, fixtures_1.expect)(driver.component).toHaveText("_I did not expect this_");
|
|
187
|
+
(0, fixtures_1.expect)(yield driver.hasHtmlElement(["pre", "code"])).toBeTruthy();
|
|
188
|
+
}));
|
|
@@ -77,7 +77,7 @@ exports.modalViewComponentRenderer = (0, renderers_1.createComponentRenderer)(CO
|
|
|
77
77
|
// (note the layoutContext and node on the MemoizedItem)
|
|
78
78
|
// one solution would be to have a renderChild that can take a contextVars argument
|
|
79
79
|
if (!(layoutContext === null || layoutContext === void 0 ? void 0 : layoutContext._insideModalFrame)) {
|
|
80
|
-
return ((0, jsx_runtime_1.jsx)(ModalDialogNative_1.ModalDialogFrame, { isInitiallyOpen: node.when !== undefined, registerComponentApi: registerComponentApi, onClose: lookupEventHandler("close"), onOpen: lookupEventHandler("open"), renderDialog: ({ openParams, ref }) => {
|
|
80
|
+
return ((0, jsx_runtime_1.jsx)(ModalDialogNative_1.ModalDialogFrame, { isInitiallyOpen: extractValue(node.when) !== undefined, registerComponentApi: registerComponentApi, onClose: lookupEventHandler("close"), onOpen: lookupEventHandler("open"), renderDialog: ({ openParams, ref }) => {
|
|
81
81
|
return ((0, jsx_runtime_1.jsx)(container_helpers_1.MemoizedItem, { node: node, renderChild: renderChild, layoutContext: { _insideModalFrame: true }, contextVars: { $param: openParams === null || openParams === void 0 ? void 0 : openParams[0], $params: openParams } }));
|
|
82
82
|
} }));
|
|
83
83
|
}
|
|
@@ -0,0 +1,162 @@
|
|
|
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
|
+
// OPEN/CLOSE TESTS
|
|
15
|
+
// =============================================================================
|
|
16
|
+
fixtures_1.test.describe("Open/Close", () => {
|
|
17
|
+
(0, fixtures_1.test)("Imperative open - without params", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
18
|
+
yield initTestBed(`
|
|
19
|
+
<Fragment>
|
|
20
|
+
<Button testId="button" onClick="modal.open()">open modal (imperative)</Button>
|
|
21
|
+
<ModalDialog id="modal">
|
|
22
|
+
<Text testId="textInModal">Hello</Text>
|
|
23
|
+
</ModalDialog>
|
|
24
|
+
</Fragment>
|
|
25
|
+
`);
|
|
26
|
+
yield (0, fixtures_1.expect)(page.getByTestId("textInModal")).not.toBeVisible();
|
|
27
|
+
yield page.getByTestId("button").click();
|
|
28
|
+
yield (0, fixtures_1.expect)(page.getByTestId("textInModal")).toBeVisible();
|
|
29
|
+
}));
|
|
30
|
+
(0, fixtures_1.test)("Imperative open - with param inside", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
31
|
+
yield initTestBed(`
|
|
32
|
+
<Fragment>
|
|
33
|
+
<Button testId="button" onClick="modal.open('PARAM_VALUE')">open modal (imperative)</Button>
|
|
34
|
+
<ModalDialog id="modal">
|
|
35
|
+
<Text testId="textInModal">{$param}</Text>
|
|
36
|
+
</ModalDialog>
|
|
37
|
+
</Fragment>
|
|
38
|
+
`);
|
|
39
|
+
yield page.getByTestId("button").click();
|
|
40
|
+
yield (0, fixtures_1.expect)(page.getByTestId("textInModal")).toHaveText("PARAM_VALUE");
|
|
41
|
+
}));
|
|
42
|
+
(0, fixtures_1.test)("Imperative open - with multiple param inside", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
43
|
+
yield initTestBed(`
|
|
44
|
+
<Fragment>
|
|
45
|
+
<Button testId="button" onClick="modal.open('PARAM_VALUE1', 'PARAM_VALUE2')">open modal (imperative)</Button>
|
|
46
|
+
<ModalDialog id="modal">
|
|
47
|
+
<Text testId="textInModal1">{$params[0]}</Text>
|
|
48
|
+
<Text testId="textInModal2">{$params[1]}</Text>
|
|
49
|
+
</ModalDialog>
|
|
50
|
+
</Fragment>
|
|
51
|
+
`);
|
|
52
|
+
yield page.getByTestId("button").click();
|
|
53
|
+
yield (0, fixtures_1.expect)(page.getByTestId("textInModal1")).toHaveText("PARAM_VALUE1");
|
|
54
|
+
yield (0, fixtures_1.expect)(page.getByTestId("textInModal2")).toHaveText("PARAM_VALUE2");
|
|
55
|
+
}));
|
|
56
|
+
(0, fixtures_1.test)("Imperative open - with param in title", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
57
|
+
yield initTestBed(`
|
|
58
|
+
<Fragment>
|
|
59
|
+
<Button testId="button" onClick="modal.open('PARAM_VALUE')">open modal (imperative)</Button>
|
|
60
|
+
<ModalDialog id="modal" title="{$param}"/>
|
|
61
|
+
</Fragment>
|
|
62
|
+
`);
|
|
63
|
+
yield page.getByTestId("button").click();
|
|
64
|
+
yield (0, fixtures_1.expect)(page.getByTestId("modal").getByRole("heading")).toHaveText("PARAM_VALUE");
|
|
65
|
+
}));
|
|
66
|
+
(0, fixtures_1.test)("Declarative open/close", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
67
|
+
yield initTestBed(`
|
|
68
|
+
<Fragment var.isOpen="{false}">
|
|
69
|
+
<Button testId="button" onClick="isOpen = true">open modal</Button>
|
|
70
|
+
<ModalDialog when="{isOpen}" onClose="isOpen = false" testId="modal">
|
|
71
|
+
<Text testId="textInModal">Hello</Text>
|
|
72
|
+
</ModalDialog>
|
|
73
|
+
<Text testId="isOpen">{isOpen + ''}</Text>
|
|
74
|
+
</Fragment>
|
|
75
|
+
`);
|
|
76
|
+
yield (0, fixtures_1.expect)(page.getByTestId("textInModal")).not.toBeVisible();
|
|
77
|
+
yield (0, fixtures_1.expect)(page.getByTestId("isOpen")).toHaveText("false");
|
|
78
|
+
yield page.getByTestId("button").click();
|
|
79
|
+
yield (0, fixtures_1.expect)(page.getByTestId("textInModal")).toBeVisible();
|
|
80
|
+
yield (0, fixtures_1.expect)(page.getByTestId("isOpen")).toHaveText("true");
|
|
81
|
+
//click modal close button
|
|
82
|
+
yield page.getByTestId("modal").getByRole("button").click();
|
|
83
|
+
yield (0, fixtures_1.expect)(page.getByTestId("textInModal")).not.toBeVisible();
|
|
84
|
+
yield (0, fixtures_1.expect)(page.getByTestId("isOpen")).toHaveText("false");
|
|
85
|
+
}));
|
|
86
|
+
(0, fixtures_1.test)("maxWidth works", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed, createModalDialogDriver }) {
|
|
87
|
+
yield initTestBed(`
|
|
88
|
+
<Fragment>
|
|
89
|
+
<Button testId="button" onClick="modal.open()">open modal (imperative)</Button>
|
|
90
|
+
<ModalDialog id="modal" maxWidth="250px">
|
|
91
|
+
<Text testId="textInModal">Hello</Text>
|
|
92
|
+
</ModalDialog>
|
|
93
|
+
</Fragment>
|
|
94
|
+
`);
|
|
95
|
+
const modal = yield createModalDialogDriver("modal");
|
|
96
|
+
yield (0, fixtures_1.expect)(modal.component).not.toBeVisible();
|
|
97
|
+
yield (0, fixtures_1.expect)(page.getByTestId("textInModal")).not.toBeVisible();
|
|
98
|
+
yield page.getByTestId("button").click();
|
|
99
|
+
yield (0, fixtures_1.expect)(modal.component).toBeVisible();
|
|
100
|
+
yield (0, fixtures_1.expect)(modal.component).toHaveCSS("max-width", "250px");
|
|
101
|
+
yield (0, fixtures_1.expect)(page.getByTestId("textInModal")).toBeVisible();
|
|
102
|
+
}));
|
|
103
|
+
(0, fixtures_1.test)("backgroundColor works", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed, createModalDialogDriver }) {
|
|
104
|
+
yield initTestBed(`
|
|
105
|
+
<Fragment>
|
|
106
|
+
<Button testId="button" onClick="modal.open()">open modal (imperative)</Button>
|
|
107
|
+
<ModalDialog id="modal" backgroundColor="rgb(255, 255, 0)">
|
|
108
|
+
<Text testId="textInModal">Hello</Text>
|
|
109
|
+
</ModalDialog>
|
|
110
|
+
</Fragment>
|
|
111
|
+
`);
|
|
112
|
+
const modal = yield createModalDialogDriver("modal");
|
|
113
|
+
yield page.getByTestId("button").click();
|
|
114
|
+
yield (0, fixtures_1.expect)(modal.component).toBeVisible();
|
|
115
|
+
yield (0, fixtures_1.expect)(modal.component).toHaveCSS("background-color", "rgb(255, 255, 0)");
|
|
116
|
+
yield (0, fixtures_1.expect)(page.getByTestId("textInModal")).toBeVisible();
|
|
117
|
+
}));
|
|
118
|
+
(0, fixtures_1.test)("modal is scrollable in fullScreen mode and hides background content", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed, createModalDialogDriver }) {
|
|
119
|
+
yield initTestBed(`
|
|
120
|
+
<Fragment>
|
|
121
|
+
<!-- Background page content that should be completely hidden by the modal -->
|
|
122
|
+
<VStack testId="pageContent" height="300vh" backgroundColor="lightblue">
|
|
123
|
+
<Button testId="button" onClick="modal.open()">
|
|
124
|
+
open modal
|
|
125
|
+
</Button>
|
|
126
|
+
<Stack height="*" verticalAlignment="end">
|
|
127
|
+
<Text testId="pageBottomText">
|
|
128
|
+
Should be hidden
|
|
129
|
+
</Text>
|
|
130
|
+
</Stack>
|
|
131
|
+
</VStack>
|
|
132
|
+
<ModalDialog id="modal" fullScreen="{true}">
|
|
133
|
+
<VStack>
|
|
134
|
+
<Text testId="textInModal">
|
|
135
|
+
Content that should be scrollable
|
|
136
|
+
</Text>
|
|
137
|
+
<Stack
|
|
138
|
+
testId="longContent"
|
|
139
|
+
height="300vh"
|
|
140
|
+
verticalAlignment="end">
|
|
141
|
+
<Text testId="bottomText">
|
|
142
|
+
Long content
|
|
143
|
+
</Text>
|
|
144
|
+
</Stack>
|
|
145
|
+
</VStack>
|
|
146
|
+
</ModalDialog>
|
|
147
|
+
</Fragment>
|
|
148
|
+
`);
|
|
149
|
+
const modal = yield createModalDialogDriver("modal");
|
|
150
|
+
// Verify page content is initially visible before opening modal
|
|
151
|
+
yield (0, fixtures_1.expect)(page.getByTestId("pageContent")).toBeVisible();
|
|
152
|
+
yield (0, fixtures_1.expect)(page.getByTestId("pageEndText")).not.toBeInViewport();
|
|
153
|
+
// Open the modal
|
|
154
|
+
yield page.getByTestId("button").click();
|
|
155
|
+
yield (0, fixtures_1.expect)(modal.component).toBeVisible();
|
|
156
|
+
// Verify modal completely covers page content - all page content should be hidden
|
|
157
|
+
yield (0, fixtures_1.expect)(page.getByTestId("textInModal")).toBeVisible();
|
|
158
|
+
yield (0, fixtures_1.expect)(page.getByTestId("bottomText")).not.toBeInViewport();
|
|
159
|
+
yield page.getByTestId("bottomText").scrollIntoViewIfNeeded();
|
|
160
|
+
yield (0, fixtures_1.expect)(page.getByTestId("pageBottomText")).not.toBeInViewport();
|
|
161
|
+
}));
|
|
162
|
+
});
|
|
@@ -182,7 +182,7 @@ exports.ModalDialog = react_1.default.forwardRef((_a, ref) => {
|
|
|
182
182
|
}
|
|
183
183
|
const Content = ((0, jsx_runtime_1.jsxs)(Dialog.Content, Object.assign({}, rest, { "data-part-id": PART_CONTENT, className: (0, classnames_1.default)(ModalDialog_module_scss_1.default.content, className), onPointerDownOutside: (event) => {
|
|
184
184
|
if (event.target instanceof Element &&
|
|
185
|
-
event.target.closest("._debug-inspect-button") !== null) {
|
|
185
|
+
(event.target.closest("._debug-inspect-button") !== null || event.target.localName === "com-1password-button")) {
|
|
186
186
|
//we prevent the auto modal close on clicking the inspect button
|
|
187
187
|
event.preventDefault();
|
|
188
188
|
}
|
|
@@ -0,0 +1,153 @@
|
|
|
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
|
+
fixtures_1.test.describe("smoke tests", { tag: "@smoke" }, () => {
|
|
14
|
+
(0, fixtures_1.test)("component renders", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
15
|
+
yield initTestBed(`
|
|
16
|
+
<NavGroup testId="navGroup" label="NavGroup">
|
|
17
|
+
</NavGroup>`);
|
|
18
|
+
yield (0, fixtures_1.expect)(page.getByTestId("navGroup")).toBeVisible();
|
|
19
|
+
}));
|
|
20
|
+
(0, fixtures_1.test)("component renders with children", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
21
|
+
yield initTestBed(`
|
|
22
|
+
<NavGroup label="NavGroup" testId="navGroup">
|
|
23
|
+
<NavLink label="link" to="/" />
|
|
24
|
+
</NavGroup>`);
|
|
25
|
+
yield (0, fixtures_1.expect)(page.getByTestId("navGroup")).toBeVisible();
|
|
26
|
+
}));
|
|
27
|
+
});
|
|
28
|
+
(0, fixtures_1.test)("component trigger has correct aria labels", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
29
|
+
yield initTestBed(`
|
|
30
|
+
<NavGroup testId="navGroup" label="NavGroup">
|
|
31
|
+
</NavGroup>`);
|
|
32
|
+
const button = page.getByTestId("navGroup");
|
|
33
|
+
yield (0, fixtures_1.expect)(button).toBeVisible();
|
|
34
|
+
yield (0, fixtures_1.expect)(button).toHaveAttribute("aria-expanded", "false");
|
|
35
|
+
yield button.click();
|
|
36
|
+
yield (0, fixtures_1.expect)(button).toHaveAttribute("aria-expanded", "true");
|
|
37
|
+
}));
|
|
38
|
+
// TODO: depending on layout, different component lists are rendered - need to test for all of them
|
|
39
|
+
/* test("component list content has correct aria labels", async ({ initTestBed, page }) => {
|
|
40
|
+
await initTestBed(`
|
|
41
|
+
<NavGroup testId="navGroup" label="NavGroup">
|
|
42
|
+
<NavLink label="link" to="/asd" />
|
|
43
|
+
</NavGroup>`);
|
|
44
|
+
const button = page.getByTestId("navGroup");
|
|
45
|
+
const content = page.getByRole('menuitem', { name: 'link' });
|
|
46
|
+
|
|
47
|
+
await button.click();
|
|
48
|
+
|
|
49
|
+
await expect(content).toBeVisible();
|
|
50
|
+
await expect(content).toHaveAttribute("aria-hidden", "false");
|
|
51
|
+
}); */
|
|
52
|
+
(0, fixtures_1.test)("expanded in NavPanel + vertical app layout if current page is same as link in group", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, }) {
|
|
53
|
+
yield initTestBed(`
|
|
54
|
+
<App layout="vertical">
|
|
55
|
+
<NavPanel>
|
|
56
|
+
<NavGroup testId="navGroup" label="NavGroup">
|
|
57
|
+
<NavLink label="link" to="/" />
|
|
58
|
+
</NavGroup>
|
|
59
|
+
</NavPanel>
|
|
60
|
+
</App>`);
|
|
61
|
+
yield (0, fixtures_1.expect)(page.getByTestId("navGroup")).toBeVisible();
|
|
62
|
+
yield (0, fixtures_1.expect)(page.locator("[data-testid='nav-group-content']")).toBeVisible();
|
|
63
|
+
}));
|
|
64
|
+
(0, fixtures_1.test)("collapsed in NavPanel + vertical app layout", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
65
|
+
yield initTestBed(`
|
|
66
|
+
<App layout="vertical">
|
|
67
|
+
<NavPanel>
|
|
68
|
+
<NavGroup testId="navGroup" label="NavGroup">
|
|
69
|
+
<NavLink label="link" to="/asd" />
|
|
70
|
+
</NavGroup>
|
|
71
|
+
</NavPanel>
|
|
72
|
+
</App>`);
|
|
73
|
+
yield (0, fixtures_1.expect)(page.getByTestId("navGroup")).toBeVisible();
|
|
74
|
+
yield (0, fixtures_1.expect)(page.locator("[data-testid='nav-group-content']")).not.toBeVisible();
|
|
75
|
+
}));
|
|
76
|
+
(0, fixtures_1.test)("expanded in NavPanel + vertical app layout", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
77
|
+
yield initTestBed(`
|
|
78
|
+
<App layout="vertical">
|
|
79
|
+
<NavPanel>
|
|
80
|
+
<NavGroup testId="navGroup" label="NavGroup">
|
|
81
|
+
<NavLink label="link" to="/" />
|
|
82
|
+
</NavGroup>
|
|
83
|
+
</NavPanel>
|
|
84
|
+
</App>`);
|
|
85
|
+
yield (0, fixtures_1.expect)(page.getByTestId("navGroup")).toBeVisible();
|
|
86
|
+
yield (0, fixtures_1.expect)(page.locator("[data-testid='nav-group-content']")).toBeVisible();
|
|
87
|
+
}));
|
|
88
|
+
(0, fixtures_1.test)("collapsed in NavPanel + horizontal app layout", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
89
|
+
yield initTestBed(`
|
|
90
|
+
<App layout="horizontal">
|
|
91
|
+
<NavPanel>
|
|
92
|
+
<NavGroup testId="navGroup" label="NavGroup">
|
|
93
|
+
<NavLink label="link" to="/" />
|
|
94
|
+
</NavGroup>
|
|
95
|
+
</NavPanel>
|
|
96
|
+
</App>`);
|
|
97
|
+
yield (0, fixtures_1.expect)(page.getByTestId("navGroup")).toBeVisible();
|
|
98
|
+
yield (0, fixtures_1.expect)(page.locator("[data-testid='nav-group-content']")).not.toBeVisible();
|
|
99
|
+
}));
|
|
100
|
+
(0, fixtures_1.test)("click expands group in NavPanel + horizontal app layout", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
101
|
+
yield initTestBed(`
|
|
102
|
+
<App layout="horizontal">
|
|
103
|
+
<NavPanel>
|
|
104
|
+
<NavGroup testId="navGroup" label="NavGroup">
|
|
105
|
+
<NavLink label="link" to="/" />
|
|
106
|
+
</NavGroup>
|
|
107
|
+
</NavPanel>
|
|
108
|
+
</App>`);
|
|
109
|
+
yield (0, fixtures_1.expect)(page.getByTestId("navGroup")).toBeVisible();
|
|
110
|
+
yield (0, fixtures_1.expect)(page.getByRole("menuitem", { name: "link" })).not.toBeVisible();
|
|
111
|
+
yield page.getByTestId("navGroup").click();
|
|
112
|
+
yield (0, fixtures_1.expect)(page.getByRole("menuitem", { name: "link" })).toBeVisible();
|
|
113
|
+
}));
|
|
114
|
+
(0, fixtures_1.test)("collapsed in vertical app layout", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
115
|
+
yield initTestBed(`
|
|
116
|
+
<App layout="vertical">
|
|
117
|
+
<NavGroup testId="navGroup" label="NavGroup">
|
|
118
|
+
<NavLink label="link" to="/asd" />
|
|
119
|
+
</NavGroup>
|
|
120
|
+
</App>`);
|
|
121
|
+
yield (0, fixtures_1.expect)(page.getByTestId("navGroup")).toBeVisible();
|
|
122
|
+
yield (0, fixtures_1.expect)(page.locator("[data-testid='nav-group-content']")).not.toBeVisible();
|
|
123
|
+
}));
|
|
124
|
+
(0, fixtures_1.test)("expanded in vertical app layout", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
125
|
+
yield initTestBed(`
|
|
126
|
+
<App layout="vertical">
|
|
127
|
+
<NavGroup testId="navGroup" label="NavGroup">
|
|
128
|
+
<NavLink label="link" to="/" />
|
|
129
|
+
</NavGroup>
|
|
130
|
+
</App>`);
|
|
131
|
+
yield (0, fixtures_1.expect)(page.getByTestId("navGroup")).toBeVisible();
|
|
132
|
+
yield (0, fixtures_1.expect)(page.locator("[data-testid='nav-group-content']")).toBeVisible();
|
|
133
|
+
}));
|
|
134
|
+
(0, fixtures_1.test)("collapsed in horizontal app layout", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
135
|
+
yield initTestBed(`
|
|
136
|
+
<App layout="horizontal">
|
|
137
|
+
<NavGroup testId="navGroup" label="NavGroup">
|
|
138
|
+
<NavLink label="link" to="/asd" />
|
|
139
|
+
</NavGroup>
|
|
140
|
+
</App>`);
|
|
141
|
+
yield (0, fixtures_1.expect)(page.getByTestId("navGroup")).toBeVisible();
|
|
142
|
+
yield (0, fixtures_1.expect)(page.locator("[data-testid='nav-group-content']")).not.toBeVisible();
|
|
143
|
+
}));
|
|
144
|
+
(0, fixtures_1.test)("collapsed in horizontal app layout if current page is same as link in group", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, }) {
|
|
145
|
+
yield initTestBed(`
|
|
146
|
+
<App layout="horizontal">
|
|
147
|
+
<NavGroup testId="navGroup" label="NavGroup">
|
|
148
|
+
<NavLink label="link" to="/" />
|
|
149
|
+
</NavGroup>
|
|
150
|
+
</App>`);
|
|
151
|
+
yield (0, fixtures_1.expect)(page.getByTestId("navGroup")).toBeVisible();
|
|
152
|
+
yield (0, fixtures_1.expect)(page.locator("[data-testid='nav-group-content']")).not.toBeVisible();
|
|
153
|
+
}));
|
|
@@ -37,7 +37,7 @@ exports.defaultProps = {
|
|
|
37
37
|
iconVerticalCollapsed: "chevronright",
|
|
38
38
|
};
|
|
39
39
|
exports.NavGroup = (0, react_1.forwardRef)(function NavGroup(_a, ref) {
|
|
40
|
-
var { node, style, label, icon, renderChild, to, disabled = false, initiallyExpanded, iconHorizontalCollapsed, iconHorizontalExpanded, iconVerticalCollapsed, iconVerticalExpanded } = _a, rest = __rest(_a, ["node", "style", "label", "icon", "renderChild", "to", "disabled", "initiallyExpanded", "iconHorizontalCollapsed", "iconHorizontalExpanded", "iconVerticalCollapsed", "iconVerticalExpanded"]);
|
|
40
|
+
var { node, style, label, icon, renderChild, to, disabled = false, initiallyExpanded = false, iconHorizontalCollapsed, iconHorizontalExpanded, iconVerticalCollapsed, iconVerticalExpanded } = _a, rest = __rest(_a, ["node", "style", "label", "icon", "renderChild", "to", "disabled", "initiallyExpanded", "iconHorizontalCollapsed", "iconHorizontalExpanded", "iconVerticalCollapsed", "iconVerticalExpanded"]);
|
|
41
41
|
const { level } = (0, react_1.useContext)(NavGroupContext_1.NavGroupContext);
|
|
42
42
|
const appLayoutContext = (0, AppLayoutContext_1.useAppLayoutContext)();
|
|
43
43
|
const navPanelContext = (0, react_1.useContext)(NavPanelNative_1.NavPanelContext);
|
|
@@ -80,7 +80,7 @@ const ExpandableNavGroup = (0, react_1.forwardRef)(function ExpandableNavGroup(_
|
|
|
80
80
|
}
|
|
81
81
|
}, [pathname]);
|
|
82
82
|
const toggleStyle = Object.assign(Object.assign({}, style), { "--nav-link-level": layoutIsVertical ? level : 0 });
|
|
83
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(NavLinkNative_1.NavLink, Object.assign({}, rest, { style: toggleStyle, onClick: () => setExpanded((prev) => !prev), icon: icon, to: to, disabled: disabled, children: [label, (0, jsx_runtime_1.jsx)("div", { style: { flex: 1 } }), (0, jsx_runtime_1.jsx)(IconNative_1.Icon, { name: expanded ? iconVerticalExpanded : iconVerticalCollapsed })] })), (0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(NavGroup_module_scss_1.default.groupContent, {
|
|
83
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(NavLinkNative_1.NavLink, Object.assign({}, rest, { style: toggleStyle, onClick: () => setExpanded((prev) => !prev), icon: icon, to: to, disabled: disabled, "aria-expanded": expanded, children: [label, (0, jsx_runtime_1.jsx)("div", { style: { flex: 1 } }), (0, jsx_runtime_1.jsx)(IconNative_1.Icon, { name: expanded ? iconVerticalExpanded : iconVerticalCollapsed })] })), (0, jsx_runtime_1.jsx)("div", { "data-testid": "nav-group-content", "aria-hidden": !expanded, className: (0, classnames_1.default)(NavGroup_module_scss_1.default.groupContent, {
|
|
84
84
|
[NavGroup_module_scss_1.default.expanded]: expanded,
|
|
85
85
|
}), children: (0, jsx_runtime_1.jsx)("div", { className: NavGroup_module_scss_1.default.groupContentInner, ref: groupContentInnerRef, children: renderChild(node.children) }) })] }));
|
|
86
86
|
});
|