xmlui 0.10.13 → 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-Db5iQkFp.mjs → index-779mp2Bm.mjs} +943 -736
- package/dist/lib/index.css +1 -1
- package/dist/lib/{initMock-B9LtmFJG.mjs → initMock-CAXdczCj.mjs} +1 -1
- package/dist/lib/xmlui.d.ts +16 -1
- package/dist/lib/xmlui.mjs +33 -32
- package/dist/metadata/{collectedComponentMetadata-BN8eg9Gr.mjs → collectedComponentMetadata-7DFXlw-J.mjs} +15057 -14865
- package/dist/metadata/{initMock-J7pN8owj.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.spec.js +283 -0
- package/dist/scripts/src/components/ColorPicker/ColorPickerNative.js +9 -26
- package/dist/scripts/src/components/Column/doc-resources/list-component-data.js +53 -0
- package/dist/scripts/src/components/ComponentProvider.js +6 -2
- package/dist/scripts/src/components/ContentSeparator/ContentSeparator.spec.js +338 -0
- package/dist/scripts/src/components/DateInput/DateInput.spec.js +918 -0
- package/dist/scripts/src/components/DatePicker/DatePicker.spec.js +362 -0
- package/dist/scripts/src/components/DatePicker/DatePickerNative.js +3 -3
- package/dist/scripts/src/components/DropdownMenu/DropdownMenu.spec.js +331 -0
- package/dist/scripts/src/components/EmojiSelector/EmojiSelector.spec.js +29 -0
- package/dist/scripts/src/components/ExpandableItem/ExpandableItem.spec.js +435 -0
- package/dist/scripts/src/components/FileInput/FileInput.spec.js +249 -0
- package/dist/scripts/src/components/FileUploadDropZone/FileUploadDropZone.spec.js +296 -0
- package/dist/scripts/src/components/FlowLayout/FlowLayout.spec.js +518 -0
- package/dist/scripts/src/components/Footer/Footer.spec.js +991 -0
- package/dist/scripts/src/components/Form/Form.spec.js +1257 -0
- package/dist/scripts/src/components/FormItem/FormItem.spec.js +723 -0
- package/dist/scripts/src/components/FormSection/FormSection.js +6 -31
- package/dist/scripts/src/components/Fragment/Fragment.spec.js +50 -0
- package/dist/scripts/src/components/Heading/H1.spec.js +66 -0
- package/dist/scripts/src/components/Heading/H2.spec.js +66 -0
- package/dist/scripts/src/components/Heading/H3.spec.js +66 -0
- package/dist/scripts/src/components/Heading/H4.spec.js +66 -0
- package/dist/scripts/src/components/Heading/H5.spec.js +66 -0
- package/dist/scripts/src/components/Heading/H6.spec.js +66 -0
- package/dist/scripts/src/components/Heading/Heading.spec.js +897 -0
- package/dist/scripts/src/components/HtmlTags/HtmlTags.spec.js +69 -0
- package/dist/scripts/src/components/IFrame/IFrame.spec.js +527 -0
- package/dist/scripts/src/components/Icon/ArrowDropDown.js +11 -0
- package/dist/scripts/src/components/Icon/ArrowDropUp.js +11 -0
- package/dist/scripts/src/components/Icon/ArrowLeft.js +11 -0
- package/dist/scripts/src/components/Icon/ArrowRight.js +11 -0
- package/dist/scripts/src/components/Icon/ChevronDownIcon.js +7 -0
- package/dist/scripts/src/components/Icon/ChevronUpIcon.js +7 -0
- package/dist/scripts/src/components/Icon/Icon.spec.js +527 -0
- package/dist/scripts/src/components/Icon/SunIcon.js +10 -0
- package/dist/scripts/src/components/Image/Image.js +2 -1
- package/dist/scripts/src/components/Image/Image.spec.js +198 -0
- package/dist/scripts/src/components/Image/ImageNative.js +30 -2
- package/dist/scripts/src/components/Input/InputLabel.js +25 -0
- package/dist/scripts/src/components/Input/index.js +5 -0
- package/dist/scripts/src/components/Items/Items.spec.js +397 -0
- package/dist/scripts/src/components/Link/Link.spec.js +894 -0
- package/dist/scripts/src/components/List/List.spec.js +927 -0
- package/dist/scripts/src/components/List/doc-resources/list-component-data.js +53 -0
- package/dist/scripts/src/components/Markdown/Markdown.spec.js +188 -0
- package/dist/scripts/src/components/ModalDialog/ModalDialog.spec.js +162 -0
- package/dist/scripts/src/components/NavGroup/NavGroup.spec.js +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/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.spec.js +555 -0
- 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.spec.js +1075 -0
- package/dist/scripts/src/components/TextArea/TextArea.spec.js +714 -0
- package/dist/scripts/src/components/TextBox/TextBox.spec.js +643 -0
- 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 +1 -1
- package/dist/scripts/src/components-core/RestApiProxy.js +85 -8
- 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/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/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 +18 -1
- package/dist/standalone/xmlui-standalone.umd.js +36 -36
- package/package.json +1 -1
|
@@ -0,0 +1,518 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const component_test_helpers_1 = require("../../testing/component-test-helpers");
|
|
13
|
+
const fixtures_1 = require("../../testing/fixtures");
|
|
14
|
+
// =============================================================================
|
|
15
|
+
// BASIC FUNCTIONALITY TESTS
|
|
16
|
+
// =============================================================================
|
|
17
|
+
fixtures_1.test.describe("Basic functionality", () => {
|
|
18
|
+
(0, fixtures_1.test)("component renders with default props", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
19
|
+
yield initTestBed(`
|
|
20
|
+
<FlowLayout>
|
|
21
|
+
<Text testId="item1">Item 1</Text>
|
|
22
|
+
<Text testId="item2">Item 2</Text>
|
|
23
|
+
<Text testId="item3">Item 3</Text>
|
|
24
|
+
</FlowLayout>
|
|
25
|
+
`);
|
|
26
|
+
// Check that the component is visible
|
|
27
|
+
const item1 = page.getByTestId("item1");
|
|
28
|
+
const rect1 = yield item1.boundingBox();
|
|
29
|
+
const item2 = page.getByTestId("item2");
|
|
30
|
+
const rect2 = yield item2.boundingBox();
|
|
31
|
+
const item3 = page.getByTestId("item3");
|
|
32
|
+
const rect3 = yield item3.boundingBox();
|
|
33
|
+
// Check that children are rendered
|
|
34
|
+
(0, fixtures_1.expect)(rect1.height).toBe(rect2.height);
|
|
35
|
+
(0, fixtures_1.expect)(rect2.height).toBe(rect3.height);
|
|
36
|
+
(0, fixtures_1.expect)(rect1.width).toBeGreaterThan(0);
|
|
37
|
+
(0, fixtures_1.expect)(rect2.width).toBeGreaterThan(0);
|
|
38
|
+
(0, fixtures_1.expect)(rect3.width).toBeGreaterThan(0);
|
|
39
|
+
(0, fixtures_1.expect)(rect1.x).toBe(rect2.x);
|
|
40
|
+
(0, fixtures_1.expect)(rect2.x).toBe(rect3.x);
|
|
41
|
+
(0, fixtures_1.expect)(rect1.y).toBeLessThan(rect2.y);
|
|
42
|
+
(0, fixtures_1.expect)(rect2.y).toBeLessThan(rect3.y);
|
|
43
|
+
}));
|
|
44
|
+
(0, fixtures_1.test)("component renders when widths specified", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
45
|
+
yield initTestBed(`
|
|
46
|
+
<FlowLayout>
|
|
47
|
+
<Text testId="item1" width="80px">Item 1</Text>
|
|
48
|
+
<Text testId="item2" width="80px">Item 2</Text>
|
|
49
|
+
<Text testId="item3" width="80px">Item 3</Text>
|
|
50
|
+
</FlowLayout>
|
|
51
|
+
`);
|
|
52
|
+
const item1 = page.getByTestId("item1");
|
|
53
|
+
const rect1 = yield item1.boundingBox();
|
|
54
|
+
const item2 = page.getByTestId("item2");
|
|
55
|
+
const rect2 = yield item2.boundingBox();
|
|
56
|
+
const item3 = page.getByTestId("item3");
|
|
57
|
+
const rect3 = yield item3.boundingBox();
|
|
58
|
+
// Check that children are rendered
|
|
59
|
+
(0, fixtures_1.expect)(rect1.height).toBe(rect2.height);
|
|
60
|
+
(0, fixtures_1.expect)(rect2.height).toBe(rect3.height);
|
|
61
|
+
(0, fixtures_1.expect)(rect1.width).toBeLessThanOrEqual(80);
|
|
62
|
+
(0, fixtures_1.expect)(rect2.width).toBeLessThanOrEqual(80);
|
|
63
|
+
(0, fixtures_1.expect)(rect3.width).toBeLessThanOrEqual(80);
|
|
64
|
+
(0, fixtures_1.expect)(rect1.y).toBe(rect2.y);
|
|
65
|
+
(0, fixtures_1.expect)(rect2.y).toBe(rect3.y);
|
|
66
|
+
(0, fixtures_1.expect)(rect1.x).toBeLessThan(rect2.x);
|
|
67
|
+
(0, fixtures_1.expect)(rect2.x).toBeLessThan(rect3.x);
|
|
68
|
+
}));
|
|
69
|
+
(0, fixtures_1.test)("component wraps items when they exceed container width", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
70
|
+
yield initTestBed(`
|
|
71
|
+
<FlowLayout width="280px">
|
|
72
|
+
<Text testId="item1" width="100px">Item 1</Text>
|
|
73
|
+
<Text testId="item2" width="100px">Item 2</Text>
|
|
74
|
+
<Text testId="item3" width="100px">Item 3</Text>
|
|
75
|
+
</FlowLayout>
|
|
76
|
+
`);
|
|
77
|
+
const item1 = page.getByTestId("item1");
|
|
78
|
+
const rect1 = yield item1.boundingBox();
|
|
79
|
+
const item2 = page.getByTestId("item2");
|
|
80
|
+
const rect2 = yield item2.boundingBox();
|
|
81
|
+
const item3 = page.getByTestId("item3");
|
|
82
|
+
const rect3 = yield item3.boundingBox();
|
|
83
|
+
// Check that children are rendered
|
|
84
|
+
(0, fixtures_1.expect)(rect1.height).toBe(rect2.height);
|
|
85
|
+
(0, fixtures_1.expect)(rect2.height).toBe(rect3.height);
|
|
86
|
+
(0, fixtures_1.expect)(rect1.y).toBe(rect2.y);
|
|
87
|
+
(0, fixtures_1.expect)(rect2.y).toBeLessThan(rect3.y);
|
|
88
|
+
(0, fixtures_1.expect)(rect1.x).toBeLessThan(rect2.x);
|
|
89
|
+
(0, fixtures_1.expect)(rect1.x).toBe(rect3.x);
|
|
90
|
+
}));
|
|
91
|
+
(0, fixtures_1.test)("component applies gap correctly (#1)", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
92
|
+
yield initTestBed(`
|
|
93
|
+
<FlowLayout gap="13px">
|
|
94
|
+
<Stack testId="item1" width="100px">Item 1</Stack>
|
|
95
|
+
<Stack testId="item2" width="100px">Item 2</Stack>
|
|
96
|
+
<Stack testId="item3" width="100px">Item 3</Stack>
|
|
97
|
+
</FlowLayout>
|
|
98
|
+
`);
|
|
99
|
+
const item1 = page.getByTestId("item1");
|
|
100
|
+
const rect1 = yield item1.boundingBox();
|
|
101
|
+
const item2 = page.getByTestId("item2");
|
|
102
|
+
const rect2 = yield item2.boundingBox();
|
|
103
|
+
const item3 = page.getByTestId("item3");
|
|
104
|
+
const rect3 = yield item3.boundingBox();
|
|
105
|
+
// Check that children are rendered
|
|
106
|
+
(0, fixtures_1.expect)(rect1.height).toBe(rect2.height);
|
|
107
|
+
(0, fixtures_1.expect)(rect2.height).toBe(rect3.height);
|
|
108
|
+
(0, fixtures_1.expect)(rect1.y).toBe(rect2.y);
|
|
109
|
+
(0, fixtures_1.expect)(rect2.y).toBe(rect3.y);
|
|
110
|
+
(0, fixtures_1.expect)(rect2.x - (rect1.x + rect1.width)).toBe(13);
|
|
111
|
+
(0, fixtures_1.expect)(rect3.x - (rect2.x + rect2.width)).toBe(13);
|
|
112
|
+
}));
|
|
113
|
+
(0, fixtures_1.test)("component applies gap correctly (#2)", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
114
|
+
yield initTestBed(`
|
|
115
|
+
<FlowLayout gap="13px">
|
|
116
|
+
<Stack testId="item1">Item 1</Stack>
|
|
117
|
+
<Stack testId="item2">Item 2</Stack>
|
|
118
|
+
<Stack testId="item3">Item 3</Stack>
|
|
119
|
+
</FlowLayout>
|
|
120
|
+
`);
|
|
121
|
+
const item1 = page.getByTestId("item1");
|
|
122
|
+
const rect1 = yield item1.boundingBox();
|
|
123
|
+
const item2 = page.getByTestId("item2");
|
|
124
|
+
const rect2 = yield item2.boundingBox();
|
|
125
|
+
const item3 = page.getByTestId("item3");
|
|
126
|
+
const rect3 = yield item3.boundingBox();
|
|
127
|
+
// Check that children are rendered
|
|
128
|
+
(0, fixtures_1.expect)(rect1.height).toBe(rect2.height);
|
|
129
|
+
(0, fixtures_1.expect)(rect2.height).toBe(rect3.height);
|
|
130
|
+
(0, fixtures_1.expect)(rect2.y - (rect1.y + rect1.height)).toBe(13);
|
|
131
|
+
(0, fixtures_1.expect)(rect3.y - (rect2.y + rect2.height)).toBe(13);
|
|
132
|
+
}));
|
|
133
|
+
(0, fixtures_1.test)("component applies columnGap correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
134
|
+
yield initTestBed(`
|
|
135
|
+
<FlowLayout columnGap="13px" gap="40px">
|
|
136
|
+
<Stack testId="item1" width="100px">Item 1</Stack>
|
|
137
|
+
<Stack testId="item2" width="100px">Item 2</Stack>
|
|
138
|
+
<Stack testId="item3" width="100px">Item 3</Stack>
|
|
139
|
+
</FlowLayout>
|
|
140
|
+
`);
|
|
141
|
+
const item1 = page.getByTestId("item1");
|
|
142
|
+
const rect1 = yield item1.boundingBox();
|
|
143
|
+
const item2 = page.getByTestId("item2");
|
|
144
|
+
const rect2 = yield item2.boundingBox();
|
|
145
|
+
const item3 = page.getByTestId("item3");
|
|
146
|
+
const rect3 = yield item3.boundingBox();
|
|
147
|
+
// Check that children are rendered
|
|
148
|
+
(0, fixtures_1.expect)(rect1.height).toBe(rect2.height);
|
|
149
|
+
(0, fixtures_1.expect)(rect2.height).toBe(rect3.height);
|
|
150
|
+
(0, fixtures_1.expect)(rect1.y).toBe(rect2.y);
|
|
151
|
+
(0, fixtures_1.expect)(rect2.y).toBe(rect3.y);
|
|
152
|
+
(0, fixtures_1.expect)(rect2.x - (rect1.x + rect1.width)).toBe(13);
|
|
153
|
+
(0, fixtures_1.expect)(rect3.x - (rect2.x + rect2.width)).toBe(13);
|
|
154
|
+
}));
|
|
155
|
+
(0, fixtures_1.test)("component applies rowGap correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
156
|
+
yield initTestBed(`
|
|
157
|
+
<FlowLayout rowGap="13px" gap="40px">
|
|
158
|
+
<Stack testId="item1">Item 1</Stack>
|
|
159
|
+
<Stack testId="item2">Item 2</Stack>
|
|
160
|
+
<Stack testId="item3">Item 3</Stack>
|
|
161
|
+
</FlowLayout>
|
|
162
|
+
`);
|
|
163
|
+
const item1 = page.getByTestId("item1");
|
|
164
|
+
const rect1 = yield item1.boundingBox();
|
|
165
|
+
const item2 = page.getByTestId("item2");
|
|
166
|
+
const rect2 = yield item2.boundingBox();
|
|
167
|
+
const item3 = page.getByTestId("item3");
|
|
168
|
+
const rect3 = yield item3.boundingBox();
|
|
169
|
+
// Check that children are rendered
|
|
170
|
+
(0, fixtures_1.expect)(rect1.height).toBe(rect2.height);
|
|
171
|
+
(0, fixtures_1.expect)(rect2.height).toBe(rect3.height);
|
|
172
|
+
(0, fixtures_1.expect)(rect2.y - (rect1.y + rect1.height)).toBe(13);
|
|
173
|
+
(0, fixtures_1.expect)(rect3.y - (rect2.y + rect2.height)).toBe(13);
|
|
174
|
+
}));
|
|
175
|
+
(0, fixtures_1.test)("component applies rowGap and columnGap correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
176
|
+
yield initTestBed(`
|
|
177
|
+
<FlowLayout width="280px" columnGap="13px" rowGap="19px" gap="40px">
|
|
178
|
+
<Stack testId="item1" width="100px">Item 1</Stack>
|
|
179
|
+
<Stack testId="item2" width="100px">Item 2</Stack>
|
|
180
|
+
<Stack testId="item3" width="100px">Item 3</Stack>
|
|
181
|
+
</FlowLayout>
|
|
182
|
+
`);
|
|
183
|
+
const item1 = page.getByTestId("item1");
|
|
184
|
+
const rect1 = yield item1.boundingBox();
|
|
185
|
+
const item2 = page.getByTestId("item2");
|
|
186
|
+
const rect2 = yield item2.boundingBox();
|
|
187
|
+
const item3 = page.getByTestId("item3");
|
|
188
|
+
const rect3 = yield item3.boundingBox();
|
|
189
|
+
// Check that children are rendered
|
|
190
|
+
(0, fixtures_1.expect)(rect1.height).toBe(rect2.height);
|
|
191
|
+
(0, fixtures_1.expect)(rect2.height).toBe(rect3.height);
|
|
192
|
+
(0, fixtures_1.expect)(rect1.y).toBe(rect2.y);
|
|
193
|
+
(0, fixtures_1.expect)(rect2.y).toBeLessThan(rect3.y);
|
|
194
|
+
(0, fixtures_1.expect)(rect1.x).toBeLessThan(rect2.x);
|
|
195
|
+
(0, fixtures_1.expect)(rect2.x - (rect1.x + rect1.width)).toBe(13);
|
|
196
|
+
(0, fixtures_1.expect)(rect3.x).toBe(rect1.x);
|
|
197
|
+
(0, fixtures_1.expect)(rect3.y - (rect2.y + rect2.height)).toBe(19);
|
|
198
|
+
}));
|
|
199
|
+
});
|
|
200
|
+
// =============================================================================
|
|
201
|
+
// EDGE CASE TESTS
|
|
202
|
+
// =============================================================================
|
|
203
|
+
fixtures_1.test.describe("Edge cases", () => {
|
|
204
|
+
(0, fixtures_1.test)("component handles empty content gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
205
|
+
yield initTestBed(`<FlowLayout testId="flowLayout"></FlowLayout>`);
|
|
206
|
+
const layout = page.getByTestId("flowLayout");
|
|
207
|
+
yield (0, fixtures_1.expect)(layout).toBeAttached();
|
|
208
|
+
yield (0, fixtures_1.expect)(layout).toBeEmpty();
|
|
209
|
+
}));
|
|
210
|
+
(0, fixtures_1.test)("component handles very long items correctly (#1)", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
211
|
+
yield initTestBed(`
|
|
212
|
+
<FlowLayout width="200px">
|
|
213
|
+
<Text testId="item1">This is a very long item that should wrap to the next line because it's too long</Text>
|
|
214
|
+
<Text testId="item2">Short item</Text>
|
|
215
|
+
</FlowLayout>
|
|
216
|
+
`);
|
|
217
|
+
const item1 = page.getByTestId("item1");
|
|
218
|
+
const rect1 = yield item1.boundingBox();
|
|
219
|
+
const item2 = page.getByTestId("item2");
|
|
220
|
+
const rect2 = yield item2.boundingBox();
|
|
221
|
+
(0, fixtures_1.expect)(rect2.y).toBeGreaterThan(rect1.y + rect1.height);
|
|
222
|
+
}));
|
|
223
|
+
(0, fixtures_1.test)("component handles very long items correctly (#2)", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
224
|
+
yield initTestBed(`
|
|
225
|
+
<FlowLayout width="200px">
|
|
226
|
+
<Text testId="item1">Short item</Text>
|
|
227
|
+
<Text testId="item2">This is a very long item that should wrap to the next line because it's too long</Text>
|
|
228
|
+
</FlowLayout>
|
|
229
|
+
`);
|
|
230
|
+
const item1 = page.getByTestId("item1");
|
|
231
|
+
const rect1 = yield item1.boundingBox();
|
|
232
|
+
const item2 = page.getByTestId("item2");
|
|
233
|
+
const rect2 = yield item2.boundingBox();
|
|
234
|
+
(0, fixtures_1.expect)(rect2.y).toBeGreaterThan(rect1.y + rect1.height);
|
|
235
|
+
}));
|
|
236
|
+
const PAGE_WIDTH = 1280;
|
|
237
|
+
(0, fixtures_1.test)("1 item 25% width", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
238
|
+
const itemHeight = "64px";
|
|
239
|
+
const itemWidthPercent = "25%";
|
|
240
|
+
yield initTestBed(`
|
|
241
|
+
<FlowLayout width="${PAGE_WIDTH}">
|
|
242
|
+
<Stack testId="item" backgroundColor="red" height="${itemHeight}" width="${itemWidthPercent}"/>
|
|
243
|
+
</FlowLayout>
|
|
244
|
+
`);
|
|
245
|
+
const expectedWidth = (0, component_test_helpers_1.scaleByPercent)(PAGE_WIDTH, itemWidthPercent);
|
|
246
|
+
const { width: itemWidth } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item"));
|
|
247
|
+
(0, fixtures_1.expect)(itemWidth).toEqual(expectedWidth);
|
|
248
|
+
}));
|
|
249
|
+
// gap should be ignored because of 1 item
|
|
250
|
+
(0, fixtures_1.test)("1 item 25% width + gap", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
251
|
+
const itemHeight = "64px";
|
|
252
|
+
const itemWidthPercent = "25%";
|
|
253
|
+
const gap = "26px";
|
|
254
|
+
yield initTestBed(`
|
|
255
|
+
<FlowLayout gap="${gap}" width="${PAGE_WIDTH}">
|
|
256
|
+
<Stack testId="item" backgroundColor="red" height="${itemHeight}" width="${itemWidthPercent}"/>
|
|
257
|
+
</FlowLayout>
|
|
258
|
+
`);
|
|
259
|
+
const { right } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item"));
|
|
260
|
+
const expectedWidth = (0, component_test_helpers_1.scaleByPercent)(PAGE_WIDTH, itemWidthPercent);
|
|
261
|
+
(0, fixtures_1.expect)(right).toEqual(expectedWidth);
|
|
262
|
+
}));
|
|
263
|
+
// gap should be ignored because of 1 item
|
|
264
|
+
(0, fixtures_1.test)("1 item 100% width + gap", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
265
|
+
const itemHeight = "64px";
|
|
266
|
+
const itemWidthPercent = "100%";
|
|
267
|
+
const gap = "26px";
|
|
268
|
+
yield initTestBed(`
|
|
269
|
+
<FlowLayout gap="${gap}" width="${PAGE_WIDTH}">
|
|
270
|
+
<Stack testId="item" backgroundColor="red" height="${itemHeight}" width="${itemWidthPercent}"/>
|
|
271
|
+
</FlowLayout>
|
|
272
|
+
`);
|
|
273
|
+
const { width } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item"));
|
|
274
|
+
const expectedWidth = PAGE_WIDTH;
|
|
275
|
+
(0, fixtures_1.expect)(width).toEqual(expectedWidth);
|
|
276
|
+
}));
|
|
277
|
+
(0, fixtures_1.test)("4 item 25% width", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
278
|
+
const layoutWidth = "400px";
|
|
279
|
+
const itemWidthPercent = "25%";
|
|
280
|
+
const itemHeight = 64;
|
|
281
|
+
yield initTestBed(`
|
|
282
|
+
<FlowLayout testId="layout" width="${layoutWidth}" backgroundColor="cyan">
|
|
283
|
+
<Stack backgroundColor="red" height="${itemHeight}px" width="${itemWidthPercent}"/>
|
|
284
|
+
<Stack backgroundColor="green" height="${itemHeight}px" width="${itemWidthPercent}"/>
|
|
285
|
+
<Stack backgroundColor="blue" height="${itemHeight}px" width="${itemWidthPercent}"/>
|
|
286
|
+
<Stack backgroundColor="yellow" height="${itemHeight}px" width="${itemWidthPercent}"/>
|
|
287
|
+
</FlowLayout>
|
|
288
|
+
`);
|
|
289
|
+
const { height: layoutHeight } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("layout"));
|
|
290
|
+
(0, fixtures_1.expect)(layoutHeight).toEqual(itemHeight);
|
|
291
|
+
}));
|
|
292
|
+
(0, fixtures_1.test)("3 item 25% width, 1 item 25.1% wraps", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
293
|
+
const itemHeight = 64;
|
|
294
|
+
const itemWidthPercent = "25%";
|
|
295
|
+
const itemWidthPercentBigger = "25.1%";
|
|
296
|
+
yield initTestBed(`
|
|
297
|
+
<FlowLayout testId="layout" width="${PAGE_WIDTH}" gap="0">
|
|
298
|
+
<Stack backgroundColor="red" height="${itemHeight}px" width="${itemWidthPercent}"/>
|
|
299
|
+
<Stack backgroundColor="green" height="${itemHeight}px" width="${itemWidthPercent}"/>
|
|
300
|
+
<Stack backgroundColor="blue" height="${itemHeight}px" width="${itemWidthPercent}"/>
|
|
301
|
+
<Stack backgroundColor="yellow" height="${itemHeight}px" width="${itemWidthPercentBigger}"/>
|
|
302
|
+
</FlowLayout>
|
|
303
|
+
`);
|
|
304
|
+
const { height: layoutHeight } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("layout"));
|
|
305
|
+
const expectedHeight = itemHeight * 2;
|
|
306
|
+
(0, fixtures_1.expect)(layoutHeight).toEqual(expectedHeight);
|
|
307
|
+
}));
|
|
308
|
+
// When gap is specified and wrapping, a horizontal gap is applied
|
|
309
|
+
(0, fixtures_1.test)("wrap with gaps", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
310
|
+
const layoutWidth = 400;
|
|
311
|
+
const itemWidthPercent = "25%";
|
|
312
|
+
const itemWidthPercentBigger = "25.1%";
|
|
313
|
+
const itemHeight = 64;
|
|
314
|
+
const gap = 20;
|
|
315
|
+
yield initTestBed(`
|
|
316
|
+
<FlowLayout testId="layout" width="${layoutWidth}px" backgroundColor="cyan" gap="${gap}px">
|
|
317
|
+
<Stack backgroundColor="red" height="${itemHeight}px" width="${itemWidthPercentBigger}"/>
|
|
318
|
+
<Stack backgroundColor="green" height="${itemHeight}px" width="${itemWidthPercent}"/>
|
|
319
|
+
<Stack backgroundColor="blue" height="${itemHeight}px" width="${itemWidthPercent}"/>
|
|
320
|
+
<Stack backgroundColor="yellow" height="${itemHeight}px" width="${itemWidthPercent}"/>
|
|
321
|
+
</FlowLayout>
|
|
322
|
+
`);
|
|
323
|
+
const { height: layoutHeight } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("layout"));
|
|
324
|
+
const expectedHeight = gap + itemHeight * 2;
|
|
325
|
+
(0, fixtures_1.expect)(layoutHeight).toEqual(expectedHeight);
|
|
326
|
+
}));
|
|
327
|
+
(0, fixtures_1.test)("item with * width fills row", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
328
|
+
const itemHeight = 64;
|
|
329
|
+
const itemWidth = "*";
|
|
330
|
+
yield initTestBed(`
|
|
331
|
+
<FlowLayout testId="layout">
|
|
332
|
+
<Stack backgroundColor="red" height="${itemHeight}px" width="50"/>
|
|
333
|
+
<Stack backgroundColor="green" height="${itemHeight}px" width="50"/>
|
|
334
|
+
<Stack testId="item2" backgroundColor="blue" height="${itemHeight}px" width="${itemWidth}"/>
|
|
335
|
+
</FlowLayout>
|
|
336
|
+
`);
|
|
337
|
+
const { height: layoutHeight, right: layoutRight } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("layout"));
|
|
338
|
+
const { right: starItemRight } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item2"));
|
|
339
|
+
(0, fixtures_1.expect)(layoutHeight).toEqual(itemHeight);
|
|
340
|
+
(0, fixtures_1.expect)(layoutRight).toEqual(starItemRight);
|
|
341
|
+
}));
|
|
342
|
+
// rowGap applies when wrapping
|
|
343
|
+
(0, fixtures_1.test)("wrap with rowGap", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
344
|
+
const itemHeight = 64;
|
|
345
|
+
const itemWidthPercent = "50%";
|
|
346
|
+
const rowGap = 24;
|
|
347
|
+
yield initTestBed(`
|
|
348
|
+
<FlowLayout testId="layout" rowGap="${rowGap}px">
|
|
349
|
+
<Stack backgroundColor="red" height="${itemHeight}px" width="${itemWidthPercent}"/>
|
|
350
|
+
<Stack backgroundColor="green" height="${itemHeight}px" width="${itemWidthPercent}"/>
|
|
351
|
+
<Stack backgroundColor="blue" height="${itemHeight}px" width="${itemWidthPercent}"/>
|
|
352
|
+
<Stack backgroundColor="yellow" height="${itemHeight}px" width="${itemWidthPercent}"/>
|
|
353
|
+
</FlowLayout>
|
|
354
|
+
`);
|
|
355
|
+
const { height: layoutHeight } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("layout"));
|
|
356
|
+
const expectedHeight = itemHeight * 2 + rowGap;
|
|
357
|
+
(0, fixtures_1.expect)(layoutHeight).toEqual(expectedHeight);
|
|
358
|
+
}));
|
|
359
|
+
(0, fixtures_1.test)("wrap with columnGap", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
360
|
+
const itemWidth = 200;
|
|
361
|
+
const columnGap = 24;
|
|
362
|
+
const layoutWidth = itemWidth + columnGap + itemWidth;
|
|
363
|
+
const itemHeight = 64;
|
|
364
|
+
yield initTestBed(`
|
|
365
|
+
<FlowLayout testId="layout" width="${layoutWidth}px" columnGap="${columnGap}px">
|
|
366
|
+
<Stack backgroundColor="red" height="${itemHeight}px" width="${itemWidth}px"/>
|
|
367
|
+
<Stack backgroundColor="green" height="${itemHeight}px" width="${itemWidth}px"/>
|
|
368
|
+
<Stack backgroundColor="blue" height="${itemHeight}px" width="${itemWidth}px"/>
|
|
369
|
+
<Stack backgroundColor="yellow" testId="item3" height="${itemHeight}px" width="${itemWidth}px"/>
|
|
370
|
+
</FlowLayout>
|
|
371
|
+
`);
|
|
372
|
+
const { left: item3Left } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item3"));
|
|
373
|
+
const expectedItem3Left = itemWidth + columnGap;
|
|
374
|
+
(0, fixtures_1.expect)(item3Left).toEqual(expectedItem3Left);
|
|
375
|
+
}));
|
|
376
|
+
// wrapping: columnGap & rowGap overrules gap prop
|
|
377
|
+
(0, fixtures_1.test)("columnGap & rowGap overrules gap", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
378
|
+
const itemWidth = 200;
|
|
379
|
+
const columnGap = 24;
|
|
380
|
+
const layoutWidth = itemWidth + columnGap + itemWidth;
|
|
381
|
+
const itemHeight = 64;
|
|
382
|
+
const rowGap = 24;
|
|
383
|
+
const gap = 5;
|
|
384
|
+
yield initTestBed(`
|
|
385
|
+
<FlowLayout testId="layout" width="${layoutWidth}px" gap="${gap}px" columnGap="${columnGap}px" rowGap="${rowGap}px">
|
|
386
|
+
<Stack testId="item0" backgroundColor="red" height="${itemHeight}px" width="${itemWidth}px"/>
|
|
387
|
+
<Stack testId="item1" backgroundColor="green" height="${itemHeight}px" width="${itemWidth}px"/>
|
|
388
|
+
<Stack testId="item2" backgroundColor="blue" height="${itemHeight}px" width="${itemWidth}px"/>
|
|
389
|
+
<Stack testId="item3" backgroundColor="yellow" height="${itemHeight}px" width="${itemWidth}px"/>
|
|
390
|
+
</FlowLayout>
|
|
391
|
+
`);
|
|
392
|
+
const { left: item3Left } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item3"));
|
|
393
|
+
const expectedItem3Left = itemWidth + columnGap;
|
|
394
|
+
const { height: layoutHeight } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("layout"));
|
|
395
|
+
const expectedLayoutHeight = itemHeight + rowGap + itemHeight;
|
|
396
|
+
(0, fixtures_1.expect)(item3Left).toEqual(expectedItem3Left);
|
|
397
|
+
(0, fixtures_1.expect)(layoutHeight).toEqual(expectedLayoutHeight);
|
|
398
|
+
}));
|
|
399
|
+
// 4 items with 25% each perfectly fit in one row
|
|
400
|
+
// gaps, borders, margins don't count when breaking into new lines
|
|
401
|
+
(0, fixtures_1.test)("no wrap from gap, border, margin", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
402
|
+
const itemHeight = 64;
|
|
403
|
+
const width = "25%";
|
|
404
|
+
const marginInline = 100;
|
|
405
|
+
yield initTestBed(`
|
|
406
|
+
<FlowLayout testId="layout" gap="26px" >
|
|
407
|
+
<Stack testId="item0" border="solid 6px black" marginRight="${marginInline}px" marginLeft="${marginInline}px" backgroundColor="red" height="${itemHeight}px" width="${width}px"/>
|
|
408
|
+
<Stack testId="item1" border="solid 6px black" marginRight="${marginInline}px" marginLeft="${marginInline}px" backgroundColor="green" height="${itemHeight}px" width="${width}px"/>
|
|
409
|
+
<Stack testId="item2" border="solid 6px black" marginRight="${marginInline}px" marginLeft="${marginInline}px" backgroundColor="blue" height="${itemHeight}px" width="${width}px"/>
|
|
410
|
+
<Stack testId="item3" border="solid 6px black" marginRight="${marginInline}px" marginLeft="${marginInline}px" backgroundColor="yellow" height="${itemHeight}px" width="${width}px"/>
|
|
411
|
+
</FlowLayout>
|
|
412
|
+
`);
|
|
413
|
+
const { height: layoutHeight } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("layout"));
|
|
414
|
+
(0, fixtures_1.expect)(layoutHeight).toEqual(itemHeight);
|
|
415
|
+
}));
|
|
416
|
+
// Elements will cap at 100% width
|
|
417
|
+
(0, fixtures_1.test)("no horizontal overflow", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
418
|
+
const itemHeight = 64;
|
|
419
|
+
const bigWidths = { percent: "120%", px: "1000000000px", em: "1000000000em" };
|
|
420
|
+
yield initTestBed(`
|
|
421
|
+
<FlowLayout testId="layout" gap="0">
|
|
422
|
+
<Stack testId="item0" height="${itemHeight}px" width="${bigWidths.percent}"/>
|
|
423
|
+
<Stack testId="item1" height="${itemHeight}px" width="${bigWidths.px}"/>
|
|
424
|
+
<Stack testId="item2" height="${itemHeight}px" width="${bigWidths.em}"/>
|
|
425
|
+
</FlowLayout>
|
|
426
|
+
`);
|
|
427
|
+
const isOverflownItem0 = yield (0, component_test_helpers_1.overflows)(page.getByTestId("item0"), "x");
|
|
428
|
+
const isOverflownItem1 = yield (0, component_test_helpers_1.overflows)(page.getByTestId("item1"), "x");
|
|
429
|
+
const isOverflownItem2 = yield (0, component_test_helpers_1.overflows)(page.getByTestId("item2"), "x");
|
|
430
|
+
const { height: layoutHeight } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("layout"));
|
|
431
|
+
const expectedLayoutHeight = itemHeight * 3;
|
|
432
|
+
(0, fixtures_1.expect)(isOverflownItem0).toStrictEqual(false);
|
|
433
|
+
(0, fixtures_1.expect)(isOverflownItem1).toStrictEqual(false);
|
|
434
|
+
(0, fixtures_1.expect)(isOverflownItem2).toStrictEqual(false);
|
|
435
|
+
(0, fixtures_1.expect)(layoutHeight).toEqual(expectedLayoutHeight);
|
|
436
|
+
}));
|
|
437
|
+
// SpaceFillers can be used to break into new lines
|
|
438
|
+
(0, fixtures_1.test)("SpaceFiller adds line break", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
439
|
+
const itemHeight = 64;
|
|
440
|
+
const itemWidth = "20%";
|
|
441
|
+
yield initTestBed(`
|
|
442
|
+
<FlowLayout testId="layout" gap="0">
|
|
443
|
+
<Stack backgroundColor="red" height="${itemHeight}px" width="${itemWidth}"/>
|
|
444
|
+
<Stack backgroundColor="blue" height="${itemHeight}px" width="${itemWidth}"/>
|
|
445
|
+
<SpaceFiller/>
|
|
446
|
+
<Stack backgroundColor="green" height="${itemHeight}px" width="${itemWidth}"/>
|
|
447
|
+
</FlowLayout>
|
|
448
|
+
`);
|
|
449
|
+
const expectedHeight = 2 * itemHeight;
|
|
450
|
+
const { height: layoutHeight } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("layout"));
|
|
451
|
+
(0, fixtures_1.expect)(layoutHeight).toEqual(expectedHeight);
|
|
452
|
+
}));
|
|
453
|
+
// The layout properly handles overflow on the Y axis
|
|
454
|
+
// The scrollbar must not overlap the rightmost element
|
|
455
|
+
(0, fixtures_1.test)("scrollbar on overflow Y", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
456
|
+
const itemHeight = 128;
|
|
457
|
+
yield initTestBed(`
|
|
458
|
+
<FlowLayout testId="layout" height="100px" columnGap="10px" overflowY="auto">
|
|
459
|
+
<Stack backgroundColor="red" height="${itemHeight}px" border="solid 8px black"/>
|
|
460
|
+
<Stack backgroundColor="blue" height="${itemHeight}px"/>
|
|
461
|
+
<Stack backgroundColor="green" height="${itemHeight}px"/>
|
|
462
|
+
</FlowLayout>
|
|
463
|
+
`);
|
|
464
|
+
const result = yield (0, component_test_helpers_1.overflows)(page.getByTestId("layout"), "y");
|
|
465
|
+
(0, fixtures_1.expect)(result).toEqual(true);
|
|
466
|
+
}));
|
|
467
|
+
// The layout properly handles overflow on the Y axis
|
|
468
|
+
// The scrollbar must not overlap the rightmost element
|
|
469
|
+
(0, fixtures_1.test)("scrollbar on overflow Y multi items", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
470
|
+
const itemHeight = 128;
|
|
471
|
+
yield initTestBed(`
|
|
472
|
+
<FlowLayout testId="layout" height="100px" overflowY="auto">
|
|
473
|
+
<Stack backgroundColor="red" height="${itemHeight}px" border="solid 8px black" width="50%"/>
|
|
474
|
+
<Stack backgroundColor="blue" height="${itemHeight}px" border="solid 8px black" width="50%"/>
|
|
475
|
+
<Stack backgroundColor="green" height="${itemHeight}px"/>
|
|
476
|
+
</FlowLayout>
|
|
477
|
+
`);
|
|
478
|
+
const result = yield (0, component_test_helpers_1.overflows)(page.getByTestId("layout"), "y");
|
|
479
|
+
(0, fixtures_1.expect)(result).toEqual(true);
|
|
480
|
+
}));
|
|
481
|
+
(0, fixtures_1.test)("multiple star sized next to each other doesn't break", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed, }) {
|
|
482
|
+
yield initTestBed(`
|
|
483
|
+
<FlowLayout testId="layout" width="100px" columnGap="10px">
|
|
484
|
+
<Stack testId="red" backgroundColor="red" height="10px" width="20px"/>
|
|
485
|
+
<Stack testId="green" backgroundColor="green" height="10px" width="*"/>
|
|
486
|
+
<Stack testId="blue" backgroundColor="blue" height="10px" width="2*"/>
|
|
487
|
+
</FlowLayout>`);
|
|
488
|
+
const { height: layoutHeight } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("layout"));
|
|
489
|
+
const { width: redWidth } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("red"));
|
|
490
|
+
const { width: greenWidth } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("green"));
|
|
491
|
+
const { width: blueWidth } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("blue"));
|
|
492
|
+
// red: 20px | 10px gap | green: 20px | 10px gap | blue: 40px
|
|
493
|
+
(0, fixtures_1.expect)(layoutHeight).toEqual(10);
|
|
494
|
+
(0, fixtures_1.expect)(redWidth).toEqual(20);
|
|
495
|
+
(0, fixtures_1.expect)(greenWidth).toEqual(20);
|
|
496
|
+
(0, fixtures_1.expect)(blueWidth).toEqual(40);
|
|
497
|
+
}));
|
|
498
|
+
(0, fixtures_1.test)("SpaceFiller breaks star sized items", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
499
|
+
yield initTestBed(`
|
|
500
|
+
<FlowLayout testId="layout" width="100px" gap="10px">
|
|
501
|
+
<Stack testId="red" backgroundColor="red" height="10px" width="20px"/>
|
|
502
|
+
<Stack testId="green" backgroundColor="green" height="10px" width="*"/>
|
|
503
|
+
<SpaceFiller/>
|
|
504
|
+
<Stack testId="blue" backgroundColor="blue" height="10px" width="2*"/>
|
|
505
|
+
</FlowLayout>`);
|
|
506
|
+
const { height: layoutHeight } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("layout"));
|
|
507
|
+
const { width: redWidth } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("red"));
|
|
508
|
+
const { width: greenWidth } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("green"));
|
|
509
|
+
const { width: blueWidth } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("blue"));
|
|
510
|
+
// red: 20px | 10px gap | green: 70px
|
|
511
|
+
// gap 10px
|
|
512
|
+
// blue: 100px
|
|
513
|
+
(0, fixtures_1.expect)(layoutHeight).toEqual(30);
|
|
514
|
+
(0, fixtures_1.expect)(redWidth).toEqual(20);
|
|
515
|
+
(0, fixtures_1.expect)(greenWidth).toEqual(70);
|
|
516
|
+
(0, fixtures_1.expect)(blueWidth).toEqual(100);
|
|
517
|
+
}));
|
|
518
|
+
});
|