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,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const component_test_helpers_1 = require("../../testing/component-test-helpers");
|
|
13
|
+
const fixtures_1 = require("../../testing/fixtures");
|
|
14
|
+
fixtures_1.test.describe("smoke tests", { tag: "@smoke" }, () => {
|
|
15
|
+
(0, fixtures_1.test)("htmlTable is rendered", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createHtmlTagDriver }) {
|
|
16
|
+
yield initTestBed(`<table />`);
|
|
17
|
+
const driver = yield createHtmlTagDriver();
|
|
18
|
+
yield (0, fixtures_1.expect)(driver.component).toBeAttached();
|
|
19
|
+
}));
|
|
20
|
+
});
|
|
21
|
+
const tableCode = `
|
|
22
|
+
<table>
|
|
23
|
+
<thead>
|
|
24
|
+
<tr>
|
|
25
|
+
<th scope="col">Person</th>
|
|
26
|
+
<th scope="col">Most interest in</th>
|
|
27
|
+
<th scope="col">Age</th>
|
|
28
|
+
</tr>
|
|
29
|
+
</thead>
|
|
30
|
+
<tbody>
|
|
31
|
+
<tr>
|
|
32
|
+
<th scope="row">Chris</th>
|
|
33
|
+
<td>HTML tables</td>
|
|
34
|
+
<td>22</td>
|
|
35
|
+
</tr>
|
|
36
|
+
<tr>
|
|
37
|
+
<th scope="row">Dennis</th>
|
|
38
|
+
<td>Web accessibility</td>
|
|
39
|
+
<td>45</td>
|
|
40
|
+
</tr>
|
|
41
|
+
<tr>
|
|
42
|
+
<th scope="row">Sarah</th>
|
|
43
|
+
<td>JavaScript frameworks</td>
|
|
44
|
+
<td>29</td>
|
|
45
|
+
</tr>
|
|
46
|
+
<tr>
|
|
47
|
+
<th scope="row">Karen</th>
|
|
48
|
+
<td>Web performance</td>
|
|
49
|
+
<td>36</td>
|
|
50
|
+
</tr>
|
|
51
|
+
</tbody>
|
|
52
|
+
<tfoot>
|
|
53
|
+
<tr>
|
|
54
|
+
<th scope="row" colSpan="2">Average age</th>
|
|
55
|
+
<td>33</td>
|
|
56
|
+
</tr>
|
|
57
|
+
</tfoot>
|
|
58
|
+
</table>
|
|
59
|
+
`;
|
|
60
|
+
(0, fixtures_1.test)("htmlTable width using themes", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createHtmlTagDriver }) {
|
|
61
|
+
const { width } = yield initTestBed(tableCode, {
|
|
62
|
+
testThemeVars: {
|
|
63
|
+
"width-HtmlTable": "100%",
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
const driver = yield createHtmlTagDriver();
|
|
67
|
+
const compWidth = (yield (0, component_test_helpers_1.getBounds)(driver)).width;
|
|
68
|
+
(0, fixtures_1.expect)(compWidth).toEqual(width);
|
|
69
|
+
}));
|
|
@@ -0,0 +1,527 @@
|
|
|
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)("component renders", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
18
|
+
yield initTestBed(`<IFrame testId="iframe" />`);
|
|
19
|
+
yield (0, fixtures_1.expect)(page.getByTestId("iframe")).toBeVisible();
|
|
20
|
+
}));
|
|
21
|
+
(0, fixtures_1.test)("component renders with 'src' property", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
22
|
+
yield initTestBed(`<IFrame src="https://example.com" testId="iframe" />`);
|
|
23
|
+
const iframe = page.getByTestId("iframe");
|
|
24
|
+
yield (0, fixtures_1.expect)(iframe).toBeVisible();
|
|
25
|
+
yield (0, fixtures_1.expect)(iframe).toHaveAttribute("src", "https://example.com");
|
|
26
|
+
}));
|
|
27
|
+
(0, fixtures_1.test)("component renders with 'srcdoc' property", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
28
|
+
const htmlContent = "<h1>Test Content</h1><p>This is embedded HTML.</p>";
|
|
29
|
+
yield initTestBed(`<IFrame srcdoc="${htmlContent}" testId="iframe" />`);
|
|
30
|
+
const iframe = page.getByTestId("iframe");
|
|
31
|
+
yield (0, fixtures_1.expect)(iframe).toBeVisible();
|
|
32
|
+
yield (0, fixtures_1.expect)(iframe).toHaveAttribute("srcdoc", htmlContent);
|
|
33
|
+
}));
|
|
34
|
+
fixtures_1.test.describe("allow property", () => {
|
|
35
|
+
(0, fixtures_1.test)("sets permissions policy", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
36
|
+
const allowValue = "camera; microphone; geolocation";
|
|
37
|
+
yield initTestBed(`<IFrame allow="${allowValue}" testId="iframe" />`);
|
|
38
|
+
const iframe = page.getByTestId("iframe");
|
|
39
|
+
yield (0, fixtures_1.expect)(iframe).toHaveAttribute("allow", allowValue);
|
|
40
|
+
}));
|
|
41
|
+
(0, fixtures_1.test)("handles empty string", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
42
|
+
yield initTestBed(`<IFrame allow="" testId="iframe" />`);
|
|
43
|
+
const iframe = page.getByTestId("iframe");
|
|
44
|
+
yield (0, fixtures_1.expect)(iframe).toHaveAttribute("allow", "");
|
|
45
|
+
}));
|
|
46
|
+
(0, fixtures_1.test)("handles null gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
47
|
+
yield initTestBed(`<IFrame allow="{null}" testId="iframe" />`);
|
|
48
|
+
const iframe = page.getByTestId("iframe");
|
|
49
|
+
yield (0, fixtures_1.expect)(iframe).not.toHaveAttribute("allow");
|
|
50
|
+
}));
|
|
51
|
+
(0, fixtures_1.test)("handles undefined gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
52
|
+
yield initTestBed(`<IFrame allow="{undefined}" testId="iframe" />`);
|
|
53
|
+
const iframe = page.getByTestId("iframe");
|
|
54
|
+
yield (0, fixtures_1.expect)(iframe).not.toHaveAttribute("allow");
|
|
55
|
+
}));
|
|
56
|
+
});
|
|
57
|
+
fixtures_1.test.describe("name property", () => {
|
|
58
|
+
(0, fixtures_1.test)("sets iframe name", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
59
|
+
yield initTestBed(`<IFrame name="myFrame" testId="iframe" />`);
|
|
60
|
+
const iframe = page.getByTestId("iframe");
|
|
61
|
+
yield (0, fixtures_1.expect)(iframe).toHaveAttribute("name", "myFrame");
|
|
62
|
+
}));
|
|
63
|
+
(0, fixtures_1.test)("handles empty string", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
64
|
+
yield initTestBed(`<IFrame name="" testId="iframe" />`);
|
|
65
|
+
const iframe = page.getByTestId("iframe");
|
|
66
|
+
yield (0, fixtures_1.expect)(iframe).toHaveAttribute("name", "");
|
|
67
|
+
}));
|
|
68
|
+
(0, fixtures_1.test)("handles null gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
69
|
+
yield initTestBed(`<IFrame name="{null}" testId="iframe" />`);
|
|
70
|
+
const iframe = page.getByTestId("iframe");
|
|
71
|
+
yield (0, fixtures_1.expect)(iframe).not.toHaveAttribute("name");
|
|
72
|
+
}));
|
|
73
|
+
(0, fixtures_1.test)("handles undefined gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
74
|
+
yield initTestBed(`<IFrame name="{undefined}" testId="iframe" />`);
|
|
75
|
+
const iframe = page.getByTestId("iframe");
|
|
76
|
+
yield (0, fixtures_1.expect)(iframe).not.toHaveAttribute("name");
|
|
77
|
+
}));
|
|
78
|
+
(0, fixtures_1.test)("handles unicode characters", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
79
|
+
const unicodeName = "测试框架👨👩👧👦";
|
|
80
|
+
yield initTestBed(`<IFrame name="${unicodeName}" testId="iframe" />`);
|
|
81
|
+
const iframe = page.getByTestId("iframe");
|
|
82
|
+
yield (0, fixtures_1.expect)(iframe).toHaveAttribute("name", unicodeName);
|
|
83
|
+
}));
|
|
84
|
+
});
|
|
85
|
+
fixtures_1.test.describe("referrerPolicy property", () => {
|
|
86
|
+
[
|
|
87
|
+
"no-referrer",
|
|
88
|
+
"no-referrer-when-downgrade",
|
|
89
|
+
"origin",
|
|
90
|
+
"origin-when-cross-origin",
|
|
91
|
+
"same-origin",
|
|
92
|
+
"strict-origin",
|
|
93
|
+
"strict-origin-when-cross-origin",
|
|
94
|
+
"unsafe-url"
|
|
95
|
+
].forEach(policy => {
|
|
96
|
+
(0, fixtures_1.test)(`sets referrerPolicy to '${policy}'`, (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
97
|
+
yield initTestBed(`<IFrame referrerPolicy="${policy}" testId="iframe" />`);
|
|
98
|
+
const iframe = page.getByTestId("iframe");
|
|
99
|
+
yield (0, fixtures_1.expect)(iframe).toHaveAttribute("referrerpolicy", policy);
|
|
100
|
+
}));
|
|
101
|
+
});
|
|
102
|
+
(0, fixtures_1.test)("handles invalid value gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
103
|
+
yield initTestBed(`<IFrame referrerPolicy="invalid-policy" testId="iframe" />`);
|
|
104
|
+
const iframe = page.getByTestId("iframe");
|
|
105
|
+
yield (0, fixtures_1.expect)(iframe).toHaveAttribute("referrerpolicy", "invalid-policy");
|
|
106
|
+
}));
|
|
107
|
+
(0, fixtures_1.test)("handles null gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
108
|
+
yield initTestBed(`<IFrame referrerPolicy="{null}" testId="iframe" />`);
|
|
109
|
+
const iframe = page.getByTestId("iframe");
|
|
110
|
+
yield (0, fixtures_1.expect)(iframe).not.toHaveAttribute("referrerpolicy");
|
|
111
|
+
}));
|
|
112
|
+
});
|
|
113
|
+
fixtures_1.test.describe("sandbox property", () => {
|
|
114
|
+
(0, fixtures_1.test)("sets sandbox restrictions", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
115
|
+
const sandboxValue = "allow-scripts allow-same-origin";
|
|
116
|
+
yield initTestBed(`<IFrame sandbox="${sandboxValue}" testId="iframe" />`);
|
|
117
|
+
const iframe = page.getByTestId("iframe");
|
|
118
|
+
yield (0, fixtures_1.expect)(iframe).toHaveAttribute("sandbox", sandboxValue);
|
|
119
|
+
}));
|
|
120
|
+
(0, fixtures_1.test)("handles empty string for strict sandboxing", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
121
|
+
yield initTestBed(`<IFrame sandbox="" testId="iframe" />`);
|
|
122
|
+
const iframe = page.getByTestId("iframe");
|
|
123
|
+
yield (0, fixtures_1.expect)(iframe).toHaveAttribute("sandbox", "");
|
|
124
|
+
}));
|
|
125
|
+
(0, fixtures_1.test)("handles single sandbox flag", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
126
|
+
yield initTestBed(`<IFrame sandbox="allow-scripts" testId="iframe" />`);
|
|
127
|
+
const iframe = page.getByTestId("iframe");
|
|
128
|
+
yield (0, fixtures_1.expect)(iframe).toHaveAttribute("sandbox", "allow-scripts");
|
|
129
|
+
}));
|
|
130
|
+
(0, fixtures_1.test)("handles null gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
131
|
+
yield initTestBed(`<IFrame sandbox="{null}" testId="iframe" />`);
|
|
132
|
+
const iframe = page.getByTestId("iframe");
|
|
133
|
+
yield (0, fixtures_1.expect)(iframe).not.toHaveAttribute("sandbox");
|
|
134
|
+
}));
|
|
135
|
+
});
|
|
136
|
+
fixtures_1.test.describe("event handlers", () => {
|
|
137
|
+
(0, fixtures_1.test)("'load' event fires when content loads", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
138
|
+
const { testStateDriver } = yield initTestBed(`
|
|
139
|
+
<IFrame
|
|
140
|
+
srcdoc="<h1>Test</h1>"
|
|
141
|
+
onLoad="testState = 'loaded'"
|
|
142
|
+
testId="iframe"
|
|
143
|
+
/>
|
|
144
|
+
`);
|
|
145
|
+
// Wait for the load event to fire
|
|
146
|
+
yield fixtures_1.expect.poll(testStateDriver.testState).toEqual("loaded");
|
|
147
|
+
}));
|
|
148
|
+
(0, fixtures_1.test)("'load' event receives event object", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
149
|
+
const { testStateDriver } = yield initTestBed(`
|
|
150
|
+
<IFrame
|
|
151
|
+
srcdoc="<h1>Test</h1>"
|
|
152
|
+
onLoad="event => testState = event.type"
|
|
153
|
+
testId="iframe"
|
|
154
|
+
/>
|
|
155
|
+
`);
|
|
156
|
+
yield fixtures_1.expect.poll(testStateDriver.testState).toEqual("load");
|
|
157
|
+
}));
|
|
158
|
+
});
|
|
159
|
+
fixtures_1.test.describe("edge case combinations", () => {
|
|
160
|
+
(0, fixtures_1.test)("handles both src and srcdoc (srcdoc should take precedence)", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
161
|
+
const htmlContent = "<h1>Srcdoc Content</h1>";
|
|
162
|
+
yield initTestBed(`<IFrame src="https://example.com" srcdoc="${htmlContent}" testId="iframe" />`);
|
|
163
|
+
const iframe = page.getByTestId("iframe");
|
|
164
|
+
yield (0, fixtures_1.expect)(iframe).toHaveAttribute("src", "https://example.com");
|
|
165
|
+
yield (0, fixtures_1.expect)(iframe).toHaveAttribute("srcdoc", htmlContent);
|
|
166
|
+
}));
|
|
167
|
+
(0, fixtures_1.test)("handles all security properties together", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
168
|
+
yield initTestBed(`
|
|
169
|
+
<IFrame
|
|
170
|
+
src="https://example.com"
|
|
171
|
+
sandbox="allow-scripts allow-same-origin"
|
|
172
|
+
allow="camera; microphone"
|
|
173
|
+
referrerPolicy="no-referrer"
|
|
174
|
+
testId="iframe"
|
|
175
|
+
/>
|
|
176
|
+
`);
|
|
177
|
+
const iframe = page.getByTestId("iframe");
|
|
178
|
+
yield (0, fixtures_1.expect)(iframe).toHaveAttribute("sandbox", "allow-scripts allow-same-origin");
|
|
179
|
+
yield (0, fixtures_1.expect)(iframe).toHaveAttribute("allow", "camera; microphone");
|
|
180
|
+
yield (0, fixtures_1.expect)(iframe).toHaveAttribute("referrerpolicy", "no-referrer");
|
|
181
|
+
}));
|
|
182
|
+
(0, fixtures_1.test)("handles extremely long URL", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
183
|
+
const longUrl = "https://example.com/" + "a".repeat(2000);
|
|
184
|
+
yield initTestBed(`<IFrame src="${longUrl}" testId="iframe" />`);
|
|
185
|
+
const iframe = page.getByTestId("iframe");
|
|
186
|
+
yield (0, fixtures_1.expect)(iframe).toHaveAttribute("src", longUrl);
|
|
187
|
+
}));
|
|
188
|
+
(0, fixtures_1.test)("handles complex HTML in srcdoc with special characters", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
189
|
+
const complexHtml = "<h1>测试</h1><p>Special chars: &lt;&gt;&amp;</p>";
|
|
190
|
+
yield initTestBed(`<IFrame srcdoc="${complexHtml}" testId="iframe" />`);
|
|
191
|
+
const iframe = page.getByTestId("iframe");
|
|
192
|
+
yield (0, fixtures_1.expect)(iframe).toBeVisible();
|
|
193
|
+
// HTML entities get decoded by the browser, so we expect the decoded version
|
|
194
|
+
yield (0, fixtures_1.expect)(iframe).toHaveAttribute("srcdoc", "<h1>测试</h1><p>Special chars: <>&</p>");
|
|
195
|
+
}));
|
|
196
|
+
});
|
|
197
|
+
});
|
|
198
|
+
// =============================================================================
|
|
199
|
+
// ACCESSIBILITY TESTS
|
|
200
|
+
// =============================================================================
|
|
201
|
+
fixtures_1.test.describe("Accessibility", () => {
|
|
202
|
+
(0, fixtures_1.test)("has correct element type", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
203
|
+
yield initTestBed(`<IFrame testId="iframe" />`);
|
|
204
|
+
// Note: iframe elements don't have an implicit role, they are identified by tag name
|
|
205
|
+
const iframe = page.getByTestId("iframe");
|
|
206
|
+
yield (0, fixtures_1.expect)(iframe).toBeVisible();
|
|
207
|
+
// Check that it's actually an iframe element
|
|
208
|
+
const tagName = yield iframe.evaluate(el => el.tagName);
|
|
209
|
+
(0, fixtures_1.expect)(tagName).toBe("IFRAME");
|
|
210
|
+
}));
|
|
211
|
+
(0, fixtures_1.test)("maintains focus management", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
212
|
+
yield initTestBed(`<IFrame testId="iframe" />`);
|
|
213
|
+
const iframe = page.getByTestId("iframe");
|
|
214
|
+
// IFrame should be focusable by default
|
|
215
|
+
yield iframe.focus();
|
|
216
|
+
yield (0, fixtures_1.expect)(iframe).toBeFocused();
|
|
217
|
+
}));
|
|
218
|
+
(0, fixtures_1.test)("can be identified by name for accessibility tools", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
219
|
+
yield initTestBed(`<IFrame name="mainContent" testId="iframe" />`);
|
|
220
|
+
const iframe = page.getByTestId("iframe");
|
|
221
|
+
yield (0, fixtures_1.expect)(iframe).toHaveAttribute("name", "mainContent");
|
|
222
|
+
// Name attribute can be used by accessibility tools to identify the frame
|
|
223
|
+
}));
|
|
224
|
+
(0, fixtures_1.test)("supports sandbox for secure content embedding", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
225
|
+
yield initTestBed(`<IFrame sandbox="allow-scripts" testId="iframe" />`);
|
|
226
|
+
const iframe = page.getByTestId("iframe");
|
|
227
|
+
yield (0, fixtures_1.expect)(iframe).toHaveAttribute("sandbox", "allow-scripts");
|
|
228
|
+
// Sandbox provides security restrictions which can help with accessibility concerns
|
|
229
|
+
}));
|
|
230
|
+
});
|
|
231
|
+
// =============================================================================
|
|
232
|
+
// THEME VARIABLE TESTS
|
|
233
|
+
// =============================================================================
|
|
234
|
+
fixtures_1.test.describe("Theme Variables", () => {
|
|
235
|
+
(0, fixtures_1.test)("applies 'width-IFrame' theme variable", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
236
|
+
yield initTestBed(`<IFrame testId="iframe" />`, {
|
|
237
|
+
testThemeVars: { "width-IFrame": "500px" },
|
|
238
|
+
});
|
|
239
|
+
yield (0, fixtures_1.expect)(page.getByTestId("iframe")).toHaveCSS("width", "500px");
|
|
240
|
+
}));
|
|
241
|
+
(0, fixtures_1.test)("applies 'height-IFrame' theme variable", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
242
|
+
yield initTestBed(`<IFrame testId="iframe" />`, {
|
|
243
|
+
testThemeVars: { "height-IFrame": "400px" },
|
|
244
|
+
});
|
|
245
|
+
yield (0, fixtures_1.expect)(page.getByTestId("iframe")).toHaveCSS("height", "400px");
|
|
246
|
+
}));
|
|
247
|
+
(0, fixtures_1.test)("applies 'borderRadius-IFrame' theme variable", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
248
|
+
yield initTestBed(`<IFrame testId="iframe" />`, {
|
|
249
|
+
testThemeVars: { "borderRadius-IFrame": "10px" },
|
|
250
|
+
});
|
|
251
|
+
yield (0, fixtures_1.expect)(page.getByTestId("iframe")).toHaveCSS("border-radius", "10px");
|
|
252
|
+
}));
|
|
253
|
+
(0, fixtures_1.test)("applies 'border-IFrame' theme variable", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
254
|
+
yield initTestBed(`<IFrame testId="iframe" />`, {
|
|
255
|
+
testThemeVars: { "border-IFrame": "2px solid rgb(255, 0, 0)" },
|
|
256
|
+
});
|
|
257
|
+
yield (0, fixtures_1.expect)(page.getByTestId("iframe")).toHaveCSS("border", "2px solid rgb(255, 0, 0)");
|
|
258
|
+
}));
|
|
259
|
+
(0, fixtures_1.test)("applies multiple theme variables together", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
260
|
+
yield initTestBed(`<IFrame testId="iframe" />`, {
|
|
261
|
+
testThemeVars: {
|
|
262
|
+
"width-IFrame": "600px",
|
|
263
|
+
"height-IFrame": "400px",
|
|
264
|
+
"borderRadius-IFrame": "8px",
|
|
265
|
+
"border-IFrame": "3px dashed rgb(0, 255, 0)"
|
|
266
|
+
},
|
|
267
|
+
});
|
|
268
|
+
const iframe = page.getByTestId("iframe");
|
|
269
|
+
yield (0, fixtures_1.expect)(iframe).toHaveCSS("width", "600px");
|
|
270
|
+
yield (0, fixtures_1.expect)(iframe).toHaveCSS("height", "400px");
|
|
271
|
+
yield (0, fixtures_1.expect)(iframe).toHaveCSS("border-radius", "8px");
|
|
272
|
+
yield (0, fixtures_1.expect)(iframe).toHaveCSS("border", "3px dashed rgb(0, 255, 0)");
|
|
273
|
+
}));
|
|
274
|
+
(0, fixtures_1.test)("falls back to default theme variables", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
275
|
+
yield initTestBed(`<IFrame testId="iframe" />`);
|
|
276
|
+
const iframe = page.getByTestId("iframe");
|
|
277
|
+
// Default height should be 300px
|
|
278
|
+
yield (0, fixtures_1.expect)(iframe).toHaveCSS("height", "300px");
|
|
279
|
+
// Should have some border (exact value depends on theme)
|
|
280
|
+
const borderStyle = yield iframe.evaluate(el => getComputedStyle(el).border);
|
|
281
|
+
(0, fixtures_1.expect)(borderStyle).toBeTruthy();
|
|
282
|
+
// Width might not be 100% in test environment but should have a computed value
|
|
283
|
+
const widthStyle = yield iframe.evaluate(el => getComputedStyle(el).width);
|
|
284
|
+
(0, fixtures_1.expect)(widthStyle).toBeTruthy();
|
|
285
|
+
}));
|
|
286
|
+
});
|
|
287
|
+
// =============================================================================
|
|
288
|
+
// OTHER EDGE CASE TESTS
|
|
289
|
+
// =============================================================================
|
|
290
|
+
fixtures_1.test.describe("Other Edge Cases", () => {
|
|
291
|
+
(0, fixtures_1.test)("handles no props gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
292
|
+
yield initTestBed(`<IFrame testId="iframe" />`);
|
|
293
|
+
const iframe = page.getByTestId("iframe");
|
|
294
|
+
yield (0, fixtures_1.expect)(iframe).toBeVisible();
|
|
295
|
+
// Should not have src or srcdoc attributes
|
|
296
|
+
yield (0, fixtures_1.expect)(iframe).not.toHaveAttribute("src");
|
|
297
|
+
yield (0, fixtures_1.expect)(iframe).not.toHaveAttribute("srcdoc");
|
|
298
|
+
}));
|
|
299
|
+
(0, fixtures_1.test)("handles invalid URL in src", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
300
|
+
yield initTestBed(`<IFrame src="not-a-valid-url" testId="iframe" />`);
|
|
301
|
+
const iframe = page.getByTestId("iframe");
|
|
302
|
+
yield (0, fixtures_1.expect)(iframe).toBeVisible();
|
|
303
|
+
// The src attribute might be transformed by XMLUI's resource URL handling
|
|
304
|
+
const srcValue = yield iframe.getAttribute("src");
|
|
305
|
+
(0, fixtures_1.expect)(srcValue).toContain("not-a-valid-url");
|
|
306
|
+
}));
|
|
307
|
+
(0, fixtures_1.test)("handles empty srcdoc", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
308
|
+
yield initTestBed(`<IFrame srcdoc="" testId="iframe" />`);
|
|
309
|
+
const iframe = page.getByTestId("iframe");
|
|
310
|
+
yield (0, fixtures_1.expect)(iframe).toBeVisible();
|
|
311
|
+
yield (0, fixtures_1.expect)(iframe).toHaveAttribute("srcdoc", "");
|
|
312
|
+
}));
|
|
313
|
+
(0, fixtures_1.test)("handles malformed HTML in srcdoc", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
314
|
+
const malformedHtml = "<div><p>Unclosed tags<span>More content";
|
|
315
|
+
yield initTestBed(`<IFrame srcdoc="${malformedHtml}" testId="iframe" />`);
|
|
316
|
+
const iframe = page.getByTestId("iframe");
|
|
317
|
+
yield (0, fixtures_1.expect)(iframe).toBeVisible();
|
|
318
|
+
yield (0, fixtures_1.expect)(iframe).toHaveAttribute("srcdoc", malformedHtml);
|
|
319
|
+
}));
|
|
320
|
+
(0, fixtures_1.test)("handles very long sandbox value", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
321
|
+
const longSandbox = Array(100).fill("allow-scripts").join(" ");
|
|
322
|
+
yield initTestBed(`<IFrame sandbox="${longSandbox}" testId="iframe" />`);
|
|
323
|
+
const iframe = page.getByTestId("iframe");
|
|
324
|
+
yield (0, fixtures_1.expect)(iframe).toHaveAttribute("sandbox", longSandbox);
|
|
325
|
+
}));
|
|
326
|
+
(0, fixtures_1.test)("maintains performance with multiple iframes", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
327
|
+
yield initTestBed(`
|
|
328
|
+
<Fragment>
|
|
329
|
+
<IFrame srcdoc="<h1>Frame 1</h1>" testId="iframe1" />
|
|
330
|
+
<IFrame srcdoc="<h1>Frame 2</h1>" testId="iframe2" />
|
|
331
|
+
<IFrame srcdoc="<h1>Frame 3</h1>" testId="iframe3" />
|
|
332
|
+
</Fragment>
|
|
333
|
+
`);
|
|
334
|
+
yield (0, fixtures_1.expect)(page.getByTestId("iframe1")).toBeVisible();
|
|
335
|
+
yield (0, fixtures_1.expect)(page.getByTestId("iframe2")).toBeVisible();
|
|
336
|
+
yield (0, fixtures_1.expect)(page.getByTestId("iframe3")).toBeVisible();
|
|
337
|
+
}));
|
|
338
|
+
(0, fixtures_1.test)("handles data URLs in src", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
339
|
+
const dataUrl = "data:text/html,<h1>Data URL Content</h1>";
|
|
340
|
+
yield initTestBed(`<IFrame src="${dataUrl}" testId="iframe" />`);
|
|
341
|
+
const iframe = page.getByTestId("iframe");
|
|
342
|
+
yield (0, fixtures_1.expect)(iframe).toBeVisible();
|
|
343
|
+
// The URL might be transformed by XMLUI's resource URL handling
|
|
344
|
+
const srcValue = yield iframe.getAttribute("src");
|
|
345
|
+
(0, fixtures_1.expect)(srcValue).toContain("data:text/html");
|
|
346
|
+
}));
|
|
347
|
+
(0, fixtures_1.test)("handles blob URLs in src", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
348
|
+
// Blob URLs are typically generated by JavaScript, so we test with a mock
|
|
349
|
+
const blobUrl = "blob:https://example.com/12345678-1234-1234-1234-123456789abc";
|
|
350
|
+
yield initTestBed(`<IFrame src="${blobUrl}" testId="iframe" />`);
|
|
351
|
+
const iframe = page.getByTestId("iframe");
|
|
352
|
+
yield (0, fixtures_1.expect)(iframe).toBeVisible();
|
|
353
|
+
// The URL might be transformed by XMLUI's resource URL handling
|
|
354
|
+
const srcValue = yield iframe.getAttribute("src");
|
|
355
|
+
(0, fixtures_1.expect)(srcValue).toContain("blob:https://example.com");
|
|
356
|
+
}));
|
|
357
|
+
});
|
|
358
|
+
// =============================================================================
|
|
359
|
+
// API TESTS
|
|
360
|
+
// =============================================================================
|
|
361
|
+
fixtures_1.test.describe("APIs", () => {
|
|
362
|
+
(0, fixtures_1.test)("postMessage sends message to iframe content window", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
363
|
+
const { testStateDriver } = yield initTestBed(`
|
|
364
|
+
<Fragment>
|
|
365
|
+
<IFrame
|
|
366
|
+
id="testIframe"
|
|
367
|
+
srcdoc="
|
|
368
|
+
<script>
|
|
369
|
+
window.addEventListener('message', (event) => {
|
|
370
|
+
window.parent.postMessage({ received: event.data }, '*');
|
|
371
|
+
});
|
|
372
|
+
</script>
|
|
373
|
+
<h1>Test IFrame</h1>
|
|
374
|
+
"
|
|
375
|
+
testId="iframe" />
|
|
376
|
+
<Button
|
|
377
|
+
onClick="
|
|
378
|
+
testIframe.postMessage({ type: 'test', message: 'Hello IFrame' }, '*');
|
|
379
|
+
testState = 'message-sent';
|
|
380
|
+
"
|
|
381
|
+
label="Send Message"
|
|
382
|
+
testId="sendButton" />
|
|
383
|
+
</Fragment>
|
|
384
|
+
`);
|
|
385
|
+
yield page.getByTestId("sendButton").click();
|
|
386
|
+
yield fixtures_1.expect.poll(testStateDriver.testState).toEqual("message-sent");
|
|
387
|
+
}));
|
|
388
|
+
(0, fixtures_1.test)("postMessage with custom target origin", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
389
|
+
const { testStateDriver } = yield initTestBed(`
|
|
390
|
+
<Fragment>
|
|
391
|
+
<IFrame
|
|
392
|
+
id="testIframe"
|
|
393
|
+
srcdoc="<h1>Test IFrame</h1>"
|
|
394
|
+
testId="iframe" />
|
|
395
|
+
<Button
|
|
396
|
+
onClick="
|
|
397
|
+
testIframe.postMessage('test-message', 'https://example.com');
|
|
398
|
+
testState = 'message-with-origin-sent';
|
|
399
|
+
"
|
|
400
|
+
label="Send Message with Origin"
|
|
401
|
+
testId="sendButton" />
|
|
402
|
+
</Fragment>
|
|
403
|
+
`);
|
|
404
|
+
yield page.getByTestId("sendButton").click();
|
|
405
|
+
yield fixtures_1.expect.poll(testStateDriver.testState).toEqual("message-with-origin-sent");
|
|
406
|
+
}));
|
|
407
|
+
(0, fixtures_1.test)("getContentWindow returns content window object", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
408
|
+
const { testStateDriver } = yield initTestBed(`
|
|
409
|
+
<Fragment>
|
|
410
|
+
<IFrame
|
|
411
|
+
id="testIframe"
|
|
412
|
+
srcdoc="<h1>Test Content</h1>"
|
|
413
|
+
testId="iframe" />
|
|
414
|
+
<Button
|
|
415
|
+
onClick="
|
|
416
|
+
const contentWindow = testIframe.getContentWindow();
|
|
417
|
+
testState = {
|
|
418
|
+
hasContentWindow: contentWindow !== null,
|
|
419
|
+
isWindow: contentWindow && typeof contentWindow.postMessage === 'function'
|
|
420
|
+
};
|
|
421
|
+
"
|
|
422
|
+
label="Get Content Window"
|
|
423
|
+
testId="getWindowButton" />
|
|
424
|
+
</Fragment>
|
|
425
|
+
`);
|
|
426
|
+
yield page.getByTestId("getWindowButton").click();
|
|
427
|
+
const result = yield testStateDriver.testState();
|
|
428
|
+
(0, fixtures_1.expect)(result.hasContentWindow).toBe(true);
|
|
429
|
+
(0, fixtures_1.expect)(result.isWindow).toBe(true);
|
|
430
|
+
}));
|
|
431
|
+
(0, fixtures_1.test)("getContentWindow returns null when iframe not loaded", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
432
|
+
const { testStateDriver } = yield initTestBed(`
|
|
433
|
+
<Fragment>
|
|
434
|
+
<IFrame
|
|
435
|
+
id="testIframe"
|
|
436
|
+
src="about:blank"
|
|
437
|
+
testId="iframe" />
|
|
438
|
+
<Button
|
|
439
|
+
onClick="
|
|
440
|
+
const contentWindow = testIframe.getContentWindow();
|
|
441
|
+
testState = { isNull: contentWindow === null };
|
|
442
|
+
"
|
|
443
|
+
label="Get Content Window"
|
|
444
|
+
testId="getWindowButton" />
|
|
445
|
+
</Fragment>
|
|
446
|
+
`);
|
|
447
|
+
// Click immediately before iframe might be fully loaded
|
|
448
|
+
yield page.getByTestId("getWindowButton").click();
|
|
449
|
+
const result = yield testStateDriver.testState();
|
|
450
|
+
// Content window should exist even for about:blank
|
|
451
|
+
(0, fixtures_1.expect)(result.isNull).toBe(false);
|
|
452
|
+
}));
|
|
453
|
+
(0, fixtures_1.test)("getContentDocument returns content document object", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
454
|
+
const { testStateDriver } = yield initTestBed(`
|
|
455
|
+
<Fragment>
|
|
456
|
+
<IFrame
|
|
457
|
+
id="testIframe"
|
|
458
|
+
srcdoc="<html><head><title>Test Document</title></head><body><h1>Test Content</h1></body></html>"
|
|
459
|
+
testId="iframe" />
|
|
460
|
+
<Button
|
|
461
|
+
onClick="
|
|
462
|
+
const contentDoc = testIframe.getContentDocument();
|
|
463
|
+
testState = {
|
|
464
|
+
hasContentDocument: contentDoc !== null,
|
|
465
|
+
documentTitle: contentDoc ? contentDoc.title : null,
|
|
466
|
+
isDocument: contentDoc && typeof contentDoc.querySelector === 'function'
|
|
467
|
+
};
|
|
468
|
+
"
|
|
469
|
+
label="Get Content Document"
|
|
470
|
+
testId="getDocButton" />
|
|
471
|
+
</Fragment>
|
|
472
|
+
`);
|
|
473
|
+
// Wait for iframe to load
|
|
474
|
+
yield page.waitForTimeout(100);
|
|
475
|
+
yield page.getByTestId("getDocButton").click();
|
|
476
|
+
const result = yield testStateDriver.testState();
|
|
477
|
+
(0, fixtures_1.expect)(result.hasContentDocument).toBe(true);
|
|
478
|
+
(0, fixtures_1.expect)(result.documentTitle).toBe("Test Document");
|
|
479
|
+
(0, fixtures_1.expect)(result.isDocument).toBe(true);
|
|
480
|
+
}));
|
|
481
|
+
(0, fixtures_1.test)("APIs work with same-origin srcdoc content", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
482
|
+
const { testStateDriver } = yield initTestBed(`
|
|
483
|
+
<Fragment>
|
|
484
|
+
<IFrame
|
|
485
|
+
id="testIframe"
|
|
486
|
+
srcdoc="
|
|
487
|
+
<html>
|
|
488
|
+
<head><title>API Test Document</title></head>
|
|
489
|
+
<body>
|
|
490
|
+
<h1>API Test Content</h1>
|
|
491
|
+
<script>
|
|
492
|
+
window.addEventListener('message', (event) => \\{
|
|
493
|
+
if (event.data.type === 'ping') \\{
|
|
494
|
+
window.parent.postMessage(\\{ type: 'pong', data: event.data.data }, '*');
|
|
495
|
+
}
|
|
496
|
+
});
|
|
497
|
+
</script>
|
|
498
|
+
</body>
|
|
499
|
+
</html>
|
|
500
|
+
"
|
|
501
|
+
testId="iframe" />
|
|
502
|
+
<Button
|
|
503
|
+
onClick="
|
|
504
|
+
const contentWindow = testIframe.getContentWindow();
|
|
505
|
+
const contentDoc = testIframe.getContentDocument();
|
|
506
|
+
testIframe.postMessage({ type: 'ping', data: 'test-data' }, '*');
|
|
507
|
+
testState = {
|
|
508
|
+
hasWindow: contentWindow !== null,
|
|
509
|
+
hasDocument: contentDoc !== null,
|
|
510
|
+
documentTitle: contentDoc ? contentDoc.title : null,
|
|
511
|
+
messageSent: true
|
|
512
|
+
};
|
|
513
|
+
"
|
|
514
|
+
label="Test All APIs"
|
|
515
|
+
testId="testAllButton" />
|
|
516
|
+
</Fragment>
|
|
517
|
+
`);
|
|
518
|
+
// Wait for iframe to load
|
|
519
|
+
yield page.waitForTimeout(100);
|
|
520
|
+
yield page.getByTestId("testAllButton").click();
|
|
521
|
+
const result = yield testStateDriver.testState();
|
|
522
|
+
(0, fixtures_1.expect)(result.hasWindow).toBe(true);
|
|
523
|
+
(0, fixtures_1.expect)(result.hasDocument).toBe(true);
|
|
524
|
+
(0, fixtures_1.expect)(result.documentTitle).toBe("API Test Document");
|
|
525
|
+
(0, fixtures_1.expect)(result.messageSent).toBe(true);
|
|
526
|
+
}));
|
|
527
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ArrowDropDown = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const ArrowDropDown_module_scss_1 = __importDefault(require("./ArrowDropDown.module.scss"));
|
|
9
|
+
const arrow_dropdown_svg_react_1 = __importDefault(require("./svg/arrow-dropdown.svg?react"));
|
|
10
|
+
const ArrowDropDown = (props) => ((0, jsx_runtime_1.jsx)(arrow_dropdown_svg_react_1.default, Object.assign({ className: ArrowDropDown_module_scss_1.default.arrowDropDown }, props)));
|
|
11
|
+
exports.ArrowDropDown = ArrowDropDown;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ArrowDropUp = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const ArrowDropUp_module_scss_1 = __importDefault(require("./ArrowDropUp.module.scss"));
|
|
9
|
+
const arrow_up_svg_react_1 = __importDefault(require("./svg/arrow-up.svg?react"));
|
|
10
|
+
const ArrowDropUp = (props) => ((0, jsx_runtime_1.jsx)(arrow_up_svg_react_1.default, Object.assign({ className: ArrowDropUp_module_scss_1.default.arrowDropUp }, props)));
|
|
11
|
+
exports.ArrowDropUp = ArrowDropUp;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ArrowLeft = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const ArrowLeft_module_scss_1 = __importDefault(require("./ArrowLeft.module.scss"));
|
|
9
|
+
const arrow_left_svg_react_1 = __importDefault(require("./svg/arrow-left.svg?react"));
|
|
10
|
+
const ArrowLeft = (props) => ((0, jsx_runtime_1.jsx)(arrow_left_svg_react_1.default, Object.assign({ className: ArrowLeft_module_scss_1.default.arrowLeft }, props)));
|
|
11
|
+
exports.ArrowLeft = ArrowLeft;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ArrowRight = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const ArrowRight_module_scss_1 = __importDefault(require("./ArrowRight.module.scss"));
|
|
9
|
+
const arrow_right_svg_react_1 = __importDefault(require("./svg/arrow-right.svg?react"));
|
|
10
|
+
const ArrowRight = (props) => ((0, jsx_runtime_1.jsx)(arrow_right_svg_react_1.default, Object.assign({ className: ArrowRight_module_scss_1.default.arrowRight }, props)));
|
|
11
|
+
exports.ArrowRight = ArrowRight;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ChevronDownIcon = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const fi_1 = require("react-icons/fi");
|
|
6
|
+
const ChevronDownIcon = (props) => (0, jsx_runtime_1.jsx)(fi_1.FiChevronDown, Object.assign({}, props));
|
|
7
|
+
exports.ChevronDownIcon = ChevronDownIcon;
|