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,654 @@
|
|
|
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
|
+
const component_test_helpers_1 = require("../../testing/component-test-helpers");
|
|
14
|
+
const PAGE_WIDTH = 1280;
|
|
15
|
+
const PAGE_HEIGHT = 720;
|
|
16
|
+
fixtures_1.test.use({ viewport: { width: PAGE_WIDTH, height: PAGE_HEIGHT } });
|
|
17
|
+
// =============================================================================
|
|
18
|
+
// BASIC FUNCTIONALITY TESTS
|
|
19
|
+
// =============================================================================
|
|
20
|
+
fixtures_1.test.describe("Basic Functionality", () => {
|
|
21
|
+
(0, fixtures_1.test)("can render empty", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
22
|
+
yield initTestBed(`<Stack testId="stack"></Stack>`);
|
|
23
|
+
yield (0, fixtures_1.expect)(page.getByTestId("stack")).toBeAttached();
|
|
24
|
+
yield (0, fixtures_1.expect)(page.getByTestId("stack")).toBeEmpty();
|
|
25
|
+
}));
|
|
26
|
+
});
|
|
27
|
+
// =============================================================================
|
|
28
|
+
// LAYOUT TESTS
|
|
29
|
+
// =============================================================================
|
|
30
|
+
fixtures_1.test.describe("Layout", () => {
|
|
31
|
+
// "(horizontal) children with unspecified dimensions" -> width is content size, height is content size
|
|
32
|
+
(0, fixtures_1.test)("(horizontal) children with unspecified dimensions", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
33
|
+
yield initTestBed(`
|
|
34
|
+
<Stack testId="stack" orientation="horizontal" backgroundColor="lightgray" gap="0">
|
|
35
|
+
<Text testId="item_0" backgroundColor="cyan">Text #1</Text>
|
|
36
|
+
<Text testId="item_1" backgroundColor="yellow">Text #2</Text>
|
|
37
|
+
<Text testId="item_2" backgroundColor="lightgreen">Text #3</Text>
|
|
38
|
+
</Stack>
|
|
39
|
+
`);
|
|
40
|
+
const { width: stackWidth, height: stackHeight } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("stack"));
|
|
41
|
+
const { width: itemWidth0, height: itemHeight0 } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_0"));
|
|
42
|
+
const { width: itemWidth1 } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_1"));
|
|
43
|
+
const { width: itemWidth2, right: itemRight2 } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_2"));
|
|
44
|
+
const itemWidthSum = itemWidth0 + itemWidth1 + itemWidth2;
|
|
45
|
+
// ensure the elements are not overflowing and that the stack is not as wide as the width-sum of the elements
|
|
46
|
+
// this can be stated, since we set the viewport size at the start,
|
|
47
|
+
// which is bigger than the width-sum of the elements
|
|
48
|
+
(0, fixtures_1.expect)(itemWidthSum).toBeLessThan(stackWidth);
|
|
49
|
+
//no gaps between elements
|
|
50
|
+
// with tolerance, since we are comparing floating point number. The pixel values could be non-whole numbers
|
|
51
|
+
// in which case adding up fractions could have a very small difference that would make the test fail
|
|
52
|
+
(0, fixtures_1.expect)(itemWidthSum).toEqualWithTolerance(itemRight2);
|
|
53
|
+
// enusre that the stack is as tall as the tallest element (they all have the same height in this case)
|
|
54
|
+
(0, fixtures_1.expect)(stackHeight).toEqual(itemHeight0);
|
|
55
|
+
}));
|
|
56
|
+
// "(vertical) children with unspecified dimensions" -> width fills available space, height is content size
|
|
57
|
+
(0, fixtures_1.test)("(vertical) children with unspecified dimensions, orientation is implicit", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed, }) {
|
|
58
|
+
yield initTestBed(`
|
|
59
|
+
<Stack testId="stack" backgroundColor="lightgray" gap="0">
|
|
60
|
+
<Text testId="item_0" backgroundColor="cyan">Text #1</Text>
|
|
61
|
+
<Text testId="item_1" backgroundColor="yellow">Text #2</Text>
|
|
62
|
+
<Text testId="item_2" backgroundColor="lightgreen">Text #3</Text>
|
|
63
|
+
</Stack>
|
|
64
|
+
`);
|
|
65
|
+
const { height: stackHeight, width: stackWidth } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("stack"));
|
|
66
|
+
const itemDims0 = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_0"));
|
|
67
|
+
const itemDims1 = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_1"));
|
|
68
|
+
const itemDims2 = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_2"));
|
|
69
|
+
const itemHeightSum = itemDims0.height + itemDims1.height + itemDims2.height;
|
|
70
|
+
(0, fixtures_1.expect)(itemHeightSum).toEqualWithTolerance(stackHeight);
|
|
71
|
+
(0, fixtures_1.expect)(itemDims0.width).toEqual(stackWidth);
|
|
72
|
+
(0, fixtures_1.expect)(itemDims1.width).toEqual(stackWidth);
|
|
73
|
+
(0, fixtures_1.expect)(itemDims2.width).toEqual(stackWidth);
|
|
74
|
+
}));
|
|
75
|
+
// "(horizontal) block children with unspecified dimensions" -> width is content size,
|
|
76
|
+
// height is content size, block children are treated as inline elements
|
|
77
|
+
(0, fixtures_1.test)("(horizontal) block children with unspecified dimensions", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
78
|
+
yield initTestBed(`
|
|
79
|
+
<Fragment>
|
|
80
|
+
<Stack testId="stack" orientation="horizontal" backgroundColor="lightgray" gap="0">
|
|
81
|
+
<Text testId="item_0" backgroundColor="cyan">Heading 1</Text>
|
|
82
|
+
<Text testId="item_1" backgroundColor="yellow">Heading 2</Text>
|
|
83
|
+
<Text testId="item_2" backgroundColor="lightgreen">Heading 3</Text>
|
|
84
|
+
</Stack>
|
|
85
|
+
<Stack testId="stack2" orientation="horizontal" backgroundColor="lightgray">
|
|
86
|
+
<Text testId="item_3" backgroundColor="coral">Heading 1Heading 2Heading 3</Text>
|
|
87
|
+
</Stack>
|
|
88
|
+
</Fragment>
|
|
89
|
+
`);
|
|
90
|
+
const { width: stackWidth, height: stackHeight } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("stack"));
|
|
91
|
+
const { width: itemWidth0, height: itemHeight0 } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_0"));
|
|
92
|
+
const { width: itemWidth1, height: itemHeight1 } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_1"));
|
|
93
|
+
const { width: itemWidth2, height: itemHeight2 } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_2"));
|
|
94
|
+
const { width: itemWidth3 } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_3"));
|
|
95
|
+
const itemWidthSum = itemWidth0 + itemWidth1 + itemWidth2;
|
|
96
|
+
const tallestItemHeight = Math.max(itemHeight0, itemHeight1, itemHeight2);
|
|
97
|
+
(0, fixtures_1.expect)(itemWidthSum).toBeLessThan(stackWidth);
|
|
98
|
+
(0, fixtures_1.expect)(itemWidthSum).toEqualWithTolerance(itemWidth3);
|
|
99
|
+
(0, fixtures_1.expect)(stackHeight).toEqual(tallestItemHeight);
|
|
100
|
+
}));
|
|
101
|
+
// "(horizontal) children with fixed dimensions" -> Stack does not alter dimensions
|
|
102
|
+
(0, fixtures_1.test)("(horizontal) children with fixed dimensions", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
103
|
+
yield initTestBed(`
|
|
104
|
+
<Stack testId="stack" orientation="horizontal" gap="0">
|
|
105
|
+
<Text testId="item_0" backgroundColor="cyan" width="72px" height="36px">72 x 36</Text>
|
|
106
|
+
<Text testId="item_1" backgroundColor="yellow" width="144px" height="72px">144 x 72</Text>
|
|
107
|
+
<Text testId="item_2" backgroundColor="lightgreen" width="64px" height="48px">64 x 48</Text>
|
|
108
|
+
</Stack>
|
|
109
|
+
`);
|
|
110
|
+
const { height: stackHeight } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("stack"));
|
|
111
|
+
const itemDims0 = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_0"));
|
|
112
|
+
const itemDims1 = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_1"));
|
|
113
|
+
const itemDims2 = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_2"));
|
|
114
|
+
const tallestItemHeight = 72;
|
|
115
|
+
const itemWidthSum = 72 + 144 + 64;
|
|
116
|
+
//no gaps between items
|
|
117
|
+
(0, fixtures_1.expect)(itemWidthSum).toEqualWithTolerance(itemDims2.right);
|
|
118
|
+
(0, fixtures_1.expect)(stackHeight).toEqual(tallestItemHeight);
|
|
119
|
+
(0, fixtures_1.expect)(itemDims0).toMatchObject({ width: 72, height: 36 });
|
|
120
|
+
(0, fixtures_1.expect)(itemDims1).toMatchObject({ width: 144, height: 72 });
|
|
121
|
+
(0, fixtures_1.expect)(itemDims2).toMatchObject({ width: 64, height: 48 });
|
|
122
|
+
}));
|
|
123
|
+
// "(vertical) children with fixed dimensions" -> Stack does not alter dimensions
|
|
124
|
+
(0, fixtures_1.test)("(vertical) children with fixed dimensions", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
125
|
+
yield initTestBed(`
|
|
126
|
+
<Stack testId="stack" orientation="vertical" gap="0">
|
|
127
|
+
<Text testId="item_0" backgroundColor="cyan" width="72px" height="36px">72 x 36</Text>
|
|
128
|
+
<Text testId="item_1" backgroundColor="yellow" width="144px" height="72px">144 x 72</Text>
|
|
129
|
+
<Text testId="item_2" backgroundColor="lightgreen" width="64px" height="48px">64 x 48</Text>
|
|
130
|
+
</Stack>
|
|
131
|
+
`);
|
|
132
|
+
const { width: stackWidth, height: stackHeight } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("stack"));
|
|
133
|
+
const itemDims0 = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_0"));
|
|
134
|
+
const itemDims1 = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_1"));
|
|
135
|
+
const itemDims2 = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_2"));
|
|
136
|
+
const widestItemWidth = 144;
|
|
137
|
+
const itemHeightSum = 36 + 72 + 48;
|
|
138
|
+
(0, fixtures_1.expect)(widestItemWidth).toBeLessThan(stackWidth);
|
|
139
|
+
(0, fixtures_1.expect)(itemHeightSum).toEqualWithTolerance(itemDims2.bottom);
|
|
140
|
+
(0, fixtures_1.expect)(itemHeightSum).toEqualWithTolerance(stackHeight);
|
|
141
|
+
(0, fixtures_1.expect)(itemDims0).toMatchObject({ width: 72, height: 36 });
|
|
142
|
+
(0, fixtures_1.expect)(itemDims1).toMatchObject({ width: 144, height: 72 });
|
|
143
|
+
(0, fixtures_1.expect)(itemDims2).toMatchObject({ width: 64, height: 48 });
|
|
144
|
+
}));
|
|
145
|
+
// (horizontal) children with fixed width and unspecified height -> item height is the same as stack height
|
|
146
|
+
(0, fixtures_1.test)("(horizontal) children with fixed width and unspecified height", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed, }) {
|
|
147
|
+
yield initTestBed(`
|
|
148
|
+
<Stack testId="stack" orientation="horizontal" gap="0">
|
|
149
|
+
<Text testId="item_0" backgroundColor="cyan" width="72px">W: 72</Text>
|
|
150
|
+
<Text testId="item_1" backgroundColor="yellow" width="144px">W: 144</Text>
|
|
151
|
+
<Text testId="item_2" backgroundColor="lightgreen" width="48px">W: 48 + long, long, long text</Text>
|
|
152
|
+
</Stack>
|
|
153
|
+
`);
|
|
154
|
+
const { height: stackHeight, width: stackWidth } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("stack"));
|
|
155
|
+
const itemDims0 = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_0"));
|
|
156
|
+
const itemDims1 = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_1"));
|
|
157
|
+
const itemDims2 = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_2"));
|
|
158
|
+
const itemWidthSum = itemDims0.width + itemDims1.width + itemDims2.width;
|
|
159
|
+
(0, fixtures_1.expect)(itemWidthSum).toEqualWithTolerance(itemDims2.right);
|
|
160
|
+
(0, fixtures_1.expect)(itemWidthSum).toBeLessThan(stackWidth);
|
|
161
|
+
(0, fixtures_1.expect)(itemDims0.height).toEqual(stackHeight);
|
|
162
|
+
(0, fixtures_1.expect)(itemDims1.height).toEqual(stackHeight);
|
|
163
|
+
(0, fixtures_1.expect)(itemDims2.height).toEqual(stackHeight);
|
|
164
|
+
(0, fixtures_1.expect)(itemDims0.width).toEqual(72);
|
|
165
|
+
(0, fixtures_1.expect)(itemDims1.width).toEqual(144);
|
|
166
|
+
(0, fixtures_1.expect)(itemDims2.width).toEqual(48);
|
|
167
|
+
}));
|
|
168
|
+
// (vertical) children with fixed height and unspecified width -> width fills available space
|
|
169
|
+
(0, fixtures_1.test)("(vertical) children with fixed height and unspecified width ", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed, }) {
|
|
170
|
+
yield initTestBed(`
|
|
171
|
+
<Stack testId="stack" orientation="vertical" gap="0">
|
|
172
|
+
<Text testId="item_0" backgroundColor="cyan" height="36px">H: 36</Text>
|
|
173
|
+
<Text testId="item_1" backgroundColor="yellow" height="72px">H: 72</Text>
|
|
174
|
+
<Text testId="item_2" backgroundColor="lightgreen" height="48px">H: 48 + long, long, long text</Text>
|
|
175
|
+
</Stack>
|
|
176
|
+
`);
|
|
177
|
+
const { height: stackHeight, width: stackWidth } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("stack"));
|
|
178
|
+
const itemDims0 = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_0"));
|
|
179
|
+
const itemDims1 = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_1"));
|
|
180
|
+
const itemDims2 = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_2"));
|
|
181
|
+
const itemHeightSum = 36 + 72 + 48;
|
|
182
|
+
(0, fixtures_1.expect)(itemHeightSum).toEqualWithTolerance(itemDims2.bottom);
|
|
183
|
+
(0, fixtures_1.expect)(itemHeightSum).toEqualWithTolerance(stackHeight);
|
|
184
|
+
(0, fixtures_1.expect)(itemDims0.width).toEqual(stackWidth);
|
|
185
|
+
(0, fixtures_1.expect)(itemDims1.width).toEqual(stackWidth);
|
|
186
|
+
(0, fixtures_1.expect)(itemDims2.width).toEqual(stackWidth);
|
|
187
|
+
(0, fixtures_1.expect)(itemDims0.height).toEqual(36);
|
|
188
|
+
(0, fixtures_1.expect)(itemDims1.height).toEqual(72);
|
|
189
|
+
(0, fixtures_1.expect)(itemDims2.height).toEqual(48);
|
|
190
|
+
}));
|
|
191
|
+
// (horizontal) children with fixed height and unspecified width -> item widths are conent size, item heights are not altered
|
|
192
|
+
(0, fixtures_1.test)("(horizontal) children with fixed height and unspecified width", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed, }) {
|
|
193
|
+
yield initTestBed(`
|
|
194
|
+
<Stack testId="stack" orientation="horizontal" gap="0">
|
|
195
|
+
<Text testId="item_0" backgroundColor="cyan" height="36px">H: 36</Text>
|
|
196
|
+
<Text testId="item_1" backgroundColor="yellow" height="72px">H: 72</Text>
|
|
197
|
+
<Text testId="item_2" backgroundColor="lightgreen" height="48px">H: 48</Text>
|
|
198
|
+
</Stack>
|
|
199
|
+
`);
|
|
200
|
+
const { height: stackHeight, width: stackWidth } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("stack"));
|
|
201
|
+
const itemDims0 = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_0"));
|
|
202
|
+
const itemDims1 = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_1"));
|
|
203
|
+
const itemDims2 = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_2"));
|
|
204
|
+
const itemWidthSum = itemDims0.width + itemDims1.width + itemDims2.width;
|
|
205
|
+
const tallestItemHeight = 72;
|
|
206
|
+
(0, fixtures_1.expect)(itemWidthSum).toBeLessThan(stackWidth);
|
|
207
|
+
(0, fixtures_1.expect)(stackHeight).toEqual(tallestItemHeight);
|
|
208
|
+
(0, fixtures_1.expect)(itemDims0.height).toEqual(36);
|
|
209
|
+
(0, fixtures_1.expect)(itemDims1.height).toEqual(72);
|
|
210
|
+
(0, fixtures_1.expect)(itemDims2.height).toEqual(48);
|
|
211
|
+
}));
|
|
212
|
+
// (vertical) children with fixed width and unspecified height -> item heights are content size, widths are not altered
|
|
213
|
+
(0, fixtures_1.test)("(vertical) children with fixed width and unspecified height", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed, }) {
|
|
214
|
+
yield initTestBed(`
|
|
215
|
+
<Stack testId="stack" orientation="vertical" gap="0">
|
|
216
|
+
<Text testId="item_0" backgroundColor="cyan" width="72px">W: 72</Text>
|
|
217
|
+
<Text testId="item_1" backgroundColor="yellow" width="144px">W: 144</Text>
|
|
218
|
+
<Text testId="item_2" backgroundColor="lightgreen" width="48px">W: 48 + long, long, long text</Text>
|
|
219
|
+
</Stack>
|
|
220
|
+
`);
|
|
221
|
+
const { height: stackHeight } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("stack"));
|
|
222
|
+
const itemDims0 = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_0"));
|
|
223
|
+
const itemDims1 = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_1"));
|
|
224
|
+
const itemDims2 = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_2"));
|
|
225
|
+
const itemHeightSum = itemDims0.height + itemDims1.height + itemDims2.height;
|
|
226
|
+
(0, fixtures_1.expect)(itemHeightSum).toEqualWithTolerance(itemDims2.bottom);
|
|
227
|
+
(0, fixtures_1.expect)(itemHeightSum).toEqualWithTolerance(stackHeight);
|
|
228
|
+
(0, fixtures_1.expect)(itemDims0.width).toEqual(72);
|
|
229
|
+
(0, fixtures_1.expect)(itemDims1.width).toEqual(144);
|
|
230
|
+
(0, fixtures_1.expect)(itemDims2.width).toEqual(48);
|
|
231
|
+
}));
|
|
232
|
+
(0, fixtures_1.test)("(horizontal) percentage sizing", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
233
|
+
yield initTestBed(`
|
|
234
|
+
<Stack testId="stack" orientation="horizontal" backgroundColor="lightgray" gap="0">
|
|
235
|
+
<Text testId="item_0" backgroundColor="cyan" width="20%">W: 20%</Text>
|
|
236
|
+
<H2 testId="item_1" backgroundColor="yellow" width="50%">W: 50%</H2>
|
|
237
|
+
<H5 testId="item_2" backgroundColor="lightgreen" width="20%">W: 20% + long, long, long text</H5>
|
|
238
|
+
</Stack>
|
|
239
|
+
`);
|
|
240
|
+
const { width: stackWidth } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("stack"));
|
|
241
|
+
const { width: itemWidth0 } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_0"));
|
|
242
|
+
const { width: itemWidth1 } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_1"));
|
|
243
|
+
const { width: itemWidth2, right: lastItemRight } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_2"));
|
|
244
|
+
const itemWidthSum = itemWidth0 + itemWidth1 + itemWidth2;
|
|
245
|
+
(0, fixtures_1.expect)(stackWidth).toEqual(PAGE_WIDTH);
|
|
246
|
+
(0, fixtures_1.expect)(itemWidthSum).toEqualWithTolerance(lastItemRight);
|
|
247
|
+
(0, fixtures_1.expect)(itemWidth0).toEqualWithTolerance(0.2 * stackWidth);
|
|
248
|
+
(0, fixtures_1.expect)(itemWidth1).toEqualWithTolerance(0.5 * stackWidth);
|
|
249
|
+
(0, fixtures_1.expect)(itemWidth2).toEqualWithTolerance(0.2 * stackWidth);
|
|
250
|
+
}));
|
|
251
|
+
(0, fixtures_1.test)("(vertical) percentage sizing", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
252
|
+
yield initTestBed(`
|
|
253
|
+
<Stack testId="stack" height="180px" orientation="vertical" backgroundColor="lightgray" gap="0">
|
|
254
|
+
<Text testId="item_0" backgroundColor="cyan" height="20%">W: 20%</Text>
|
|
255
|
+
<Text testId="item_1" backgroundColor="yellow" height="50%">W: 50%</Text>
|
|
256
|
+
<Text testId="item_2" backgroundColor="lightgreen" height="20%">W: 20% + long, long, long text</Text>
|
|
257
|
+
</Stack>
|
|
258
|
+
`);
|
|
259
|
+
const { height: stackHeight, width: stackWidth } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("stack"));
|
|
260
|
+
const { height: itemHeight0, width: itemWidth0 } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_0"));
|
|
261
|
+
const { height: itemHeight1 } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_1"));
|
|
262
|
+
const { height: itemHeight2, bottom: lastItemBottom } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_2"));
|
|
263
|
+
const itemHeightSum = itemHeight0 + itemHeight1 + itemHeight2;
|
|
264
|
+
(0, fixtures_1.expect)(itemWidth0).toEqual(stackWidth);
|
|
265
|
+
(0, fixtures_1.expect)(itemHeightSum).toEqualWithTolerance(lastItemBottom);
|
|
266
|
+
(0, fixtures_1.expect)(itemHeight0).toEqualWithTolerance(0.2 * stackHeight);
|
|
267
|
+
(0, fixtures_1.expect)(itemHeight1).toEqualWithTolerance(0.5 * stackHeight);
|
|
268
|
+
(0, fixtures_1.expect)(itemHeight2).toEqualWithTolerance(0.2 * stackHeight);
|
|
269
|
+
}));
|
|
270
|
+
(0, fixtures_1.test)("(horizontal) percentage sizing fully filled", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
271
|
+
yield initTestBed(`
|
|
272
|
+
<Stack testId="stack" orientation="horizontal" backgroundColor="lightgray" gap="0">
|
|
273
|
+
<Text testId="item_0" backgroundColor="cyan" width="20%">W: 20%</Text>
|
|
274
|
+
<H2 testId="item_1" backgroundColor="yellow" width="50%">W: 50%</H2>
|
|
275
|
+
<H5 testId="item_2" backgroundColor="lightgreen" width="30%">W: 30% + long, long, long text</H5>
|
|
276
|
+
</Stack>
|
|
277
|
+
`);
|
|
278
|
+
const { width: stackWidth } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("stack"));
|
|
279
|
+
const { right: lastItemRight } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_2"));
|
|
280
|
+
(0, fixtures_1.expect)(stackWidth).toEqualWithTolerance(lastItemRight);
|
|
281
|
+
}));
|
|
282
|
+
(0, fixtures_1.test)("(vertical) percentage sizing fully filled", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
283
|
+
yield initTestBed(`
|
|
284
|
+
<Stack testId="stack" height="180px" orientation="vertical" backgroundColor="lightgray" gap="0">
|
|
285
|
+
<Text testId="item_0" backgroundColor="cyan" height="20%">W: 20%</Text>
|
|
286
|
+
<Text testId="item_1" backgroundColor="yellow" height="50%">W: 50%</Text>
|
|
287
|
+
<Text testId="item_2" backgroundColor="lightgreen" height="30%">W: 30% + long, long, long text</Text>
|
|
288
|
+
</Stack>
|
|
289
|
+
`);
|
|
290
|
+
const { height: stackHeight } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("stack"));
|
|
291
|
+
const { bottom: lastItemBottom } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_2"));
|
|
292
|
+
(0, fixtures_1.expect)(stackHeight).toEqualWithTolerance(lastItemBottom);
|
|
293
|
+
}));
|
|
294
|
+
// (horizontal) percentage overflow X
|
|
295
|
+
(0, fixtures_1.test)("(horizontal) percentage overflow X", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
296
|
+
yield initTestBed(`
|
|
297
|
+
<Stack testId="stack" orientation="horizontal" backgroundColor="lightgray" gap="0">
|
|
298
|
+
<Text testId="item_0" backgroundColor="cyan" width="30%">W: 30%</Text>
|
|
299
|
+
<H2 testId="item_1" backgroundColor="yellow" width="50%">W: 50%</H2>
|
|
300
|
+
<H5 testId="item_2" backgroundColor="lightgreen" width="40%">W: 40% + long, long, long text</H5>
|
|
301
|
+
</Stack>
|
|
302
|
+
`);
|
|
303
|
+
const isOverflown = yield (0, component_test_helpers_1.overflows)(page.getByTestId("stack"), "x");
|
|
304
|
+
(0, fixtures_1.expect)(isOverflown).toEqual(true);
|
|
305
|
+
}));
|
|
306
|
+
// (vertical) percentage overflow Y
|
|
307
|
+
(0, fixtures_1.test)("(vertical) percentage overflow Y", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
308
|
+
yield initTestBed(`
|
|
309
|
+
<Stack testId="stack" orientation="vertical" height="180px" backgroundColor="lightgray" gap="0">
|
|
310
|
+
<Text testId="item_0" backgroundColor="cyan" height="30%">H: 30%</Text>
|
|
311
|
+
<H2 testId="item_1" backgroundColor="yellow" height="60%">H: 60%</H2>
|
|
312
|
+
<H5 testId="item_2" backgroundColor="lightgreen" height="20%">H: 20% + long, long, long text</H5>
|
|
313
|
+
</Stack>
|
|
314
|
+
`);
|
|
315
|
+
const isOverflown = yield (0, component_test_helpers_1.overflows)(page.getByTestId("stack"), "y");
|
|
316
|
+
(0, fixtures_1.expect)(isOverflown).toEqual(true);
|
|
317
|
+
}));
|
|
318
|
+
(0, fixtures_1.test)("(horizontal) star sizing", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
319
|
+
yield initTestBed(`
|
|
320
|
+
<Stack testId="stack" width="100%" orientation="horizontal" backgroundColor="lightgray" gap="0">
|
|
321
|
+
<Text testId="item_0" backgroundColor="cyan" width="100px">W: 100</Text>
|
|
322
|
+
<Text testId="item_1" backgroundColor="yellow" width="3*">W: 3*</Text>
|
|
323
|
+
<Text testId="item_2" backgroundColor="lightgreen" width="*">W: *</Text>
|
|
324
|
+
</Stack>
|
|
325
|
+
`);
|
|
326
|
+
const { width: stackWidth } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("stack"));
|
|
327
|
+
const { width: itemWidth0 } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_0"));
|
|
328
|
+
const { width: itemWidth1 } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_1"));
|
|
329
|
+
const { width: itemWidth2, right: lastItemRight } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_2"));
|
|
330
|
+
const itemWidthSum = itemWidth0 + itemWidth1 + itemWidth2;
|
|
331
|
+
const expectedItemWidth0 = 100;
|
|
332
|
+
const expectedItemWidth1 = (stackWidth - 100) * (3 / 4);
|
|
333
|
+
const expectedItemWidth2 = (stackWidth - 100) * (1 / 4);
|
|
334
|
+
(0, fixtures_1.expect)(itemWidthSum).toEqualWithTolerance(lastItemRight);
|
|
335
|
+
(0, fixtures_1.expect)(itemWidth0).toEqual(expectedItemWidth0);
|
|
336
|
+
(0, fixtures_1.expect)(itemWidth1).toEqualWithTolerance(expectedItemWidth1);
|
|
337
|
+
(0, fixtures_1.expect)(itemWidth2).toEqualWithTolerance(expectedItemWidth2);
|
|
338
|
+
}));
|
|
339
|
+
// (horizontal) star sizing comparison -> Larger Stack have larger star sized children, px sizes are same
|
|
340
|
+
(0, fixtures_1.test)("(horizontal) star sizing comparison", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
341
|
+
yield initTestBed(`
|
|
342
|
+
<Fragment>
|
|
343
|
+
<Stack testId="stack_0" orientation="horizontal" width="600px" gap="0">
|
|
344
|
+
<Text testId="ref_item_0" backgroundColor="cyan" width="100px">W: 100</Text>
|
|
345
|
+
<Text testId="ref_item_1" backgroundColor="yellow" width="3*">W: 3*</Text>
|
|
346
|
+
<Text testId="ref_item_2" backgroundColor="lightgreen" width="*">W: *</Text>
|
|
347
|
+
</Stack>
|
|
348
|
+
<Stack testId="stack_1" orientation="horizontal" width="300px" gap="0">
|
|
349
|
+
<Text testId="item_0" backgroundColor="cyan" width="100px">W: 100</Text>
|
|
350
|
+
<Text testId="item_1" backgroundColor="yellow" width="3*">W: 3*</Text>
|
|
351
|
+
<Text testId="item_2" backgroundColor="lightgreen" width="*">W: *</Text>
|
|
352
|
+
</Stack>
|
|
353
|
+
</Fragment>
|
|
354
|
+
`);
|
|
355
|
+
const { width: refItemWidth0 } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("ref_item_0"));
|
|
356
|
+
const { width: refItemWidth1 } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("ref_item_1"));
|
|
357
|
+
const { width: refItemWidth2 } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("ref_item_2"));
|
|
358
|
+
const { width: itemWidth0 } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_0"));
|
|
359
|
+
const { width: itemWidth1 } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_1"));
|
|
360
|
+
const { width: itemWidth2 } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_2"));
|
|
361
|
+
(0, fixtures_1.expect)(refItemWidth0).toEqual(itemWidth0);
|
|
362
|
+
(0, fixtures_1.expect)(refItemWidth1).toBeGreaterThan(itemWidth1);
|
|
363
|
+
(0, fixtures_1.expect)(refItemWidth2).toBeGreaterThan(itemWidth2);
|
|
364
|
+
}));
|
|
365
|
+
// (vertical) star sizing comparison -> Larger Stack have larger star sized children, px sizes are same
|
|
366
|
+
(0, fixtures_1.test)("(vertical) star sizing comparison", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
367
|
+
yield initTestBed(`
|
|
368
|
+
<Fragment>
|
|
369
|
+
<Stack testId="stack_0" orientation="vertical" height="600px" gap="0">
|
|
370
|
+
<Text testId="ref_item_0" backgroundColor="cyan" height="100px">W: 100</Text>
|
|
371
|
+
<Text testId="ref_item_1" backgroundColor="yellow" height="3*">W: 3*</Text>
|
|
372
|
+
<Text testId="ref_item_2" backgroundColor="lightgreen" height="*">W: *</Text>
|
|
373
|
+
</Stack>
|
|
374
|
+
<Stack testId="stack_1" orientation="vertical" height="300px" gap="0">
|
|
375
|
+
<Text testId="item_0" backgroundColor="cyan" height="100px">W: 100</Text>
|
|
376
|
+
<Text testId="item_1" backgroundColor="yellow" height="3*">W: 3*</Text>
|
|
377
|
+
<Text testId="item_2" backgroundColor="lightgreen" height="*">W: *</Text>
|
|
378
|
+
</Stack>
|
|
379
|
+
</Fragment>
|
|
380
|
+
`);
|
|
381
|
+
const { height: refItemHeight0 } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("ref_item_0"));
|
|
382
|
+
const { height: refItemHeight1 } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("ref_item_1"));
|
|
383
|
+
const { height: refItemHeight2 } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("ref_item_2"));
|
|
384
|
+
const { height: itemHeight0 } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_0"));
|
|
385
|
+
const { height: itemHeight1 } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_1"));
|
|
386
|
+
const { height: itemHeight2 } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_2"));
|
|
387
|
+
(0, fixtures_1.expect)(refItemHeight0).toEqual(itemHeight0);
|
|
388
|
+
(0, fixtures_1.expect)(refItemHeight1).toBeGreaterThan(itemHeight1);
|
|
389
|
+
(0, fixtures_1.expect)(refItemHeight2).toBeGreaterThan(itemHeight2);
|
|
390
|
+
}));
|
|
391
|
+
// (horizontal) gaps + percentage -> children use available space
|
|
392
|
+
(0, fixtures_1.test)("(horizontal) paddings + percentage", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
393
|
+
yield initTestBed(`
|
|
394
|
+
<Stack testId="stack" orientation="horizontal" backgroundColor="lightgray" gap="0"
|
|
395
|
+
paddingHorizontal="50px" paddingVertical="50px">
|
|
396
|
+
<Text testId="item_0" backgroundColor="cyan" width="25%">W: 25%</Text>
|
|
397
|
+
<Text testId="item_1" backgroundColor="yellow" width="50%">W: 50%</Text>
|
|
398
|
+
<Text testId="item_2" backgroundColor="lightgreen" width="25%">W: 25%</Text>
|
|
399
|
+
</Stack>
|
|
400
|
+
`);
|
|
401
|
+
const { width: stackWidth } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("stack"));
|
|
402
|
+
const { width: itemWidth0, left: firstItemLeft } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_0"));
|
|
403
|
+
const { width: itemWidth1 } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_1"));
|
|
404
|
+
const { width: itemWidth2, right: lastItemRight } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_2"));
|
|
405
|
+
const itemWidthSum = itemWidth0 + itemWidth1 + itemWidth2;
|
|
406
|
+
(0, fixtures_1.expect)(firstItemLeft).toEqual(50);
|
|
407
|
+
(0, fixtures_1.expect)(lastItemRight).toEqual(stackWidth - 50);
|
|
408
|
+
(0, fixtures_1.expect)(itemWidthSum).toEqualWithTolerance(stackWidth - 2 * 50);
|
|
409
|
+
}));
|
|
410
|
+
// (vertical) gaps + percentage -> children use available space
|
|
411
|
+
(0, fixtures_1.test)("(vertical) paddings + percentage", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
412
|
+
yield initTestBed(`
|
|
413
|
+
<Stack testId="stack" orientation="vertical" backgroundColor="lightgray" gap="0"
|
|
414
|
+
height="240px" paddingHorizontal="50px" paddingVertical="50px">
|
|
415
|
+
<Text testId="item_0" backgroundColor="cyan" height="25%">H: 25%</Text>
|
|
416
|
+
<Text testId="item_1" backgroundColor="yellow" height="50%">H: 50%</Text>
|
|
417
|
+
<Text testId="item_2" backgroundColor="lightgreen" height="25%">H: 25%</Text>
|
|
418
|
+
</Stack>
|
|
419
|
+
`);
|
|
420
|
+
const { height: stackHeight } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("stack"));
|
|
421
|
+
const { top: firstItemTop } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_0"));
|
|
422
|
+
const { bottom: lastItemBottom } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_2"));
|
|
423
|
+
(0, fixtures_1.expect)(firstItemTop).toEqual(50);
|
|
424
|
+
(0, fixtures_1.expect)(lastItemBottom).toEqual(stackHeight - 50);
|
|
425
|
+
}));
|
|
426
|
+
(0, fixtures_1.test)("(horizontal) gaps", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
427
|
+
yield initTestBed(`
|
|
428
|
+
<Stack orientation="horizontal" backgroundColor="lightgray" gap="50px">
|
|
429
|
+
<Stack testId="item_0" backgroundColor="red" height="36px" width="36px" />
|
|
430
|
+
<Stack testId="item_1" backgroundColor="green" height="36px" width="36px" />
|
|
431
|
+
<Stack testId="item_2" backgroundColor="blue" height="36px" width="36px" />
|
|
432
|
+
</Stack>
|
|
433
|
+
`);
|
|
434
|
+
const itemDims0 = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_0"));
|
|
435
|
+
const itemDims1 = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_1"));
|
|
436
|
+
const itemDims2 = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_2"));
|
|
437
|
+
(0, fixtures_1.expect)(itemDims0.left).toEqual(0);
|
|
438
|
+
(0, fixtures_1.expect)(itemDims1.left).toEqual(itemDims0.right + 50);
|
|
439
|
+
(0, fixtures_1.expect)(itemDims2.left).toEqual(2 * (itemDims0.right + 50));
|
|
440
|
+
}));
|
|
441
|
+
(0, fixtures_1.test)("(vertical) gaps", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
442
|
+
yield initTestBed(`
|
|
443
|
+
<Stack orientation="vertical" backgroundColor="lightgray" gap="50px">
|
|
444
|
+
<Stack testId="item_0" backgroundColor="red" height="36px" width="36px" />
|
|
445
|
+
<Stack testId="item_1" backgroundColor="green" height="36px" width="36px" />
|
|
446
|
+
<Stack testId="item_2" backgroundColor="blue" height="36px" width="36px" />
|
|
447
|
+
</Stack>
|
|
448
|
+
`);
|
|
449
|
+
const itemDims0 = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_0"));
|
|
450
|
+
const itemDims1 = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_1"));
|
|
451
|
+
const itemDims2 = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_2"));
|
|
452
|
+
(0, fixtures_1.expect)(itemDims0.top).toEqual(0);
|
|
453
|
+
(0, fixtures_1.expect)(itemDims1.top).toEqual(itemDims0.bottom + 50);
|
|
454
|
+
(0, fixtures_1.expect)(itemDims2.top).toEqual(2 * (itemDims0.bottom + 50));
|
|
455
|
+
}));
|
|
456
|
+
// (horizontal) gaps + percentage -> gaps push the content out of the container
|
|
457
|
+
(0, fixtures_1.test)("(horizontal) gaps + percentage", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
458
|
+
yield initTestBed(`
|
|
459
|
+
<Stack testId="stack" orientation="horizontal" backgroundColor="lightgray" padding="1rem" gap="2rem">
|
|
460
|
+
<Stack backgroundColor="red" height="36px" width="25%" />
|
|
461
|
+
<Stack backgroundColor="green" height="36px" width="50%" />
|
|
462
|
+
<Stack backgroundColor="blue" height="36px" width="25%" />
|
|
463
|
+
</Stack>
|
|
464
|
+
`);
|
|
465
|
+
const isOverflown = yield (0, component_test_helpers_1.overflows)(page.getByTestId("stack"), "x");
|
|
466
|
+
(0, fixtures_1.expect)(isOverflown).toEqual(true);
|
|
467
|
+
}));
|
|
468
|
+
// (horizontal) gaps + star sizing -> gaps don't push the content out of the container
|
|
469
|
+
(0, fixtures_1.test)("(horizontal) gaps + star sizing", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
470
|
+
yield initTestBed(`
|
|
471
|
+
<Stack testId="stack" orientation="horizontal" backgroundColor="lightgray" padding="1rem" gap="2rem">
|
|
472
|
+
<Stack backgroundColor="red" height="36px" width="*" />
|
|
473
|
+
<Stack backgroundColor="green" height="36px" width="*" />
|
|
474
|
+
<Stack backgroundColor="blue" height="36px" width="*" />
|
|
475
|
+
<Stack backgroundColor="purple" height="36px" width="*" />
|
|
476
|
+
</Stack>
|
|
477
|
+
`);
|
|
478
|
+
const isOverflown = yield (0, component_test_helpers_1.overflows)(page.getByTestId("stack"), "x");
|
|
479
|
+
(0, fixtures_1.expect)(isOverflown).toEqual(false);
|
|
480
|
+
}));
|
|
481
|
+
(0, fixtures_1.test)("(horizontal) rtl rendering direction", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
482
|
+
yield initTestBed(`
|
|
483
|
+
<Stack testId="stack" orientation="horizontal" gap="1rem" direction="rtl">
|
|
484
|
+
<Stack testId="item_0" backgroundColor="red" height="36px" width="36px" />
|
|
485
|
+
<Stack testId="item_1" backgroundColor="green" height="36px" width="36px" />
|
|
486
|
+
<Stack testId="item_2" backgroundColor="blue" height="36px" width="36px" />
|
|
487
|
+
</Stack>
|
|
488
|
+
`);
|
|
489
|
+
const { right: stackRight } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("stack"));
|
|
490
|
+
const { right: itemRight0, left: itemLeft0 } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_0"));
|
|
491
|
+
const { left: itemLeft1 } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_1"));
|
|
492
|
+
const { left: itemLeft2 } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_2"));
|
|
493
|
+
(0, fixtures_1.expect)(itemLeft2).toBeLessThan(itemLeft1);
|
|
494
|
+
(0, fixtures_1.expect)(itemLeft1).toBeLessThan(itemLeft0);
|
|
495
|
+
(0, fixtures_1.expect)(itemRight0).toEqual(stackRight);
|
|
496
|
+
}));
|
|
497
|
+
(0, fixtures_1.test)("(horizontal) reverse rendering direction", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
498
|
+
yield initTestBed(`
|
|
499
|
+
<Stack testId="stack" orientation="horizontal" gap="1rem" reverse="true">
|
|
500
|
+
<Stack testId="item_0" backgroundColor="red" height="36px" width="36px" />
|
|
501
|
+
<Stack testId="item_1" backgroundColor="green" height="36px" width="36px" />
|
|
502
|
+
<Stack testId="item_2" backgroundColor="blue" height="36px" width="36px" />
|
|
503
|
+
</Stack>
|
|
504
|
+
`);
|
|
505
|
+
const { right: stackRight } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("stack"));
|
|
506
|
+
const { right: itemRight0, left: itemLeft0 } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_0"));
|
|
507
|
+
const { left: itemLeft1 } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_1"));
|
|
508
|
+
const { left: itemLeft2 } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_2"));
|
|
509
|
+
(0, fixtures_1.expect)(itemLeft2).toBeLessThan(itemLeft1);
|
|
510
|
+
(0, fixtures_1.expect)(itemLeft1).toBeLessThan(itemLeft0);
|
|
511
|
+
(0, fixtures_1.expect)(itemRight0).toEqual(stackRight);
|
|
512
|
+
}));
|
|
513
|
+
(0, fixtures_1.test)("(vertical) reverse rendering direction", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
514
|
+
yield initTestBed(`
|
|
515
|
+
<Stack testId="stack" orientation="vertical" gap="1rem" reverse="true">
|
|
516
|
+
<Stack testId="item_0" backgroundColor="red" height="36px" width="36px" />
|
|
517
|
+
<Stack testId="item_1" backgroundColor="green" height="36px" width="36px" />
|
|
518
|
+
<Stack testId="item_2" backgroundColor="blue" height="36px" width="36px" />
|
|
519
|
+
</Stack>
|
|
520
|
+
`);
|
|
521
|
+
const { bottom: stackBottom } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("stack"));
|
|
522
|
+
const { bottom: itemBottom0, top: itemTop0 } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_0"));
|
|
523
|
+
const { top: itemTop1 } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_1"));
|
|
524
|
+
const { top: itemTop2 } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_2"));
|
|
525
|
+
(0, fixtures_1.expect)(itemTop2).toBeLessThan(itemTop1);
|
|
526
|
+
(0, fixtures_1.expect)(itemTop1).toBeLessThan(itemTop0);
|
|
527
|
+
(0, fixtures_1.expect)(itemBottom0).toEqual(stackBottom);
|
|
528
|
+
}));
|
|
529
|
+
(0, fixtures_1.test)("(horizontal) content wrapping", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
530
|
+
yield initTestBed(`
|
|
531
|
+
<Stack testId="stack" orientation="horizontal" gap="1rem" wrapContent="true">
|
|
532
|
+
<Stack testId="item_0" backgroundColor="red" height="36px" width="25%" />
|
|
533
|
+
<Stack testId="item_1" backgroundColor="green" height="36px" width="40%" />
|
|
534
|
+
<Stack testId="item_2" backgroundColor="blue" height="36px" width="20%" />
|
|
535
|
+
<Stack testId="item_3" backgroundColor="purple" height="36px" width="30%" />
|
|
536
|
+
</Stack>
|
|
537
|
+
`);
|
|
538
|
+
const { right: stackRight, bottom: stackBottom } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("stack"));
|
|
539
|
+
const { left: itemLeft0, bottom: itemBottom0 } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_0"));
|
|
540
|
+
const { left: itemLeft1 } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_1"));
|
|
541
|
+
const { left: itemLeft2, right: itemRight2 } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_2"));
|
|
542
|
+
const { left: itemLeft3, bottom: itemBottom3, top: itemTop3, } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_3"));
|
|
543
|
+
(0, fixtures_1.expect)(itemLeft0).toBeLessThan(itemLeft1);
|
|
544
|
+
(0, fixtures_1.expect)(itemLeft1).toBeLessThan(itemLeft2);
|
|
545
|
+
(0, fixtures_1.expect)(itemRight2).toBeLessThan(stackRight);
|
|
546
|
+
(0, fixtures_1.expect)(itemBottom0).toBeLessThan(itemTop3);
|
|
547
|
+
(0, fixtures_1.expect)(itemLeft3).toEqual(itemLeft0);
|
|
548
|
+
(0, fixtures_1.expect)(itemBottom3).toEqual(stackBottom);
|
|
549
|
+
}));
|
|
550
|
+
(0, fixtures_1.test)("(horizontal) horizontalAlignment center", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
551
|
+
yield initTestBed(`
|
|
552
|
+
<Stack testId="stack" orientation="horizontal" horizontalAlignment="center" gap="0">
|
|
553
|
+
<Stack testId="item_0" backgroundColor="red" height="36px" width="36px" />
|
|
554
|
+
<Stack testId="item_1" backgroundColor="green" height="36px" width="36px" />
|
|
555
|
+
<Stack testId="item_2" backgroundColor="blue" height="36px" width="36px" />
|
|
556
|
+
</Stack>
|
|
557
|
+
`);
|
|
558
|
+
const { right: stackRight } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("stack"));
|
|
559
|
+
const { left: itemLeft0 } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_0"));
|
|
560
|
+
const { right: itemRight2 } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_2"));
|
|
561
|
+
const itemWidthSum = 3 * 36;
|
|
562
|
+
(0, fixtures_1.expect)(itemLeft0).toEqual(stackRight / 2 - itemWidthSum / 2);
|
|
563
|
+
(0, fixtures_1.expect)(itemRight2).toEqual(stackRight / 2 + itemWidthSum / 2);
|
|
564
|
+
}));
|
|
565
|
+
(0, fixtures_1.test)("(vertical) horizontal alignment end", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
566
|
+
yield initTestBed(`
|
|
567
|
+
<Stack testId="stack" orientation="vertical" horizontalAlignment="end" gap="0">
|
|
568
|
+
<Stack testId="item_0" backgroundColor="red" height="36px" width="36px" />
|
|
569
|
+
<Stack testId="item_1" backgroundColor="green" height="36px" width="36px" />
|
|
570
|
+
<Stack testId="item_2" backgroundColor="blue" height="36px" width="36px" />
|
|
571
|
+
</Stack>
|
|
572
|
+
`);
|
|
573
|
+
const { right: stackRight } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("stack"));
|
|
574
|
+
const { right: itemRight0 } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_0"));
|
|
575
|
+
const { right: itemRight1 } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_1"));
|
|
576
|
+
const { right: itemRight2 } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_2"));
|
|
577
|
+
(0, fixtures_1.expect)(itemRight0).toEqual(stackRight);
|
|
578
|
+
(0, fixtures_1.expect)(itemRight1).toEqual(stackRight);
|
|
579
|
+
(0, fixtures_1.expect)(itemRight2).toEqual(stackRight);
|
|
580
|
+
}));
|
|
581
|
+
(0, fixtures_1.test)("(horizontal) verticalAlignment center", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
582
|
+
yield initTestBed(`
|
|
583
|
+
<Stack testId="stack" orientation="horizontal" gap="1rem" verticalAlignment="center">
|
|
584
|
+
<Stack testId="item_0" backgroundColor="red" height="36px" width="36px" />
|
|
585
|
+
<Stack testId="item_1" backgroundColor="green" height="72px" width="36px" />
|
|
586
|
+
<Stack testId="item_2" backgroundColor="blue" height="48px" width="36px" />
|
|
587
|
+
</Stack>
|
|
588
|
+
`);
|
|
589
|
+
const stackDims = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("stack"));
|
|
590
|
+
const itemDims0 = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_0"));
|
|
591
|
+
const itemDims1 = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_1"));
|
|
592
|
+
const itemDims2 = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("item_2"));
|
|
593
|
+
(0, fixtures_1.expect)(itemDims0.top).toEqual(stackDims.height / 2 - itemDims0.height / 2);
|
|
594
|
+
(0, fixtures_1.expect)(itemDims0.bottom).toEqual(stackDims.height / 2 + itemDims0.height / 2);
|
|
595
|
+
(0, fixtures_1.expect)(itemDims1.top).toEqual(stackDims.top);
|
|
596
|
+
(0, fixtures_1.expect)(itemDims1.bottom).toEqual(stackDims.bottom);
|
|
597
|
+
(0, fixtures_1.expect)(itemDims2.top).toEqual(stackDims.height / 2 - itemDims2.height / 2);
|
|
598
|
+
(0, fixtures_1.expect)(itemDims2.bottom).toEqual(stackDims.height / 2 + itemDims2.height / 2);
|
|
599
|
+
}));
|
|
600
|
+
(0, fixtures_1.test)(`overflowY="scroll"`, (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
601
|
+
yield initTestBed(`
|
|
602
|
+
<VStack testId="stack" width="100px" height="60px" backgroundColor="cyan"
|
|
603
|
+
overflowY="scroll">
|
|
604
|
+
<Text testId="item0">
|
|
605
|
+
As its container width and height are fixed, this long text does not
|
|
606
|
+
fit into it; it will overflow.
|
|
607
|
+
</Text>
|
|
608
|
+
</VStack>
|
|
609
|
+
`);
|
|
610
|
+
const { scrollHeight, clientHeight } = yield page
|
|
611
|
+
.getByTestId("stack")
|
|
612
|
+
.evaluate((elem) => ({ scrollHeight: elem.scrollHeight, clientHeight: elem.clientHeight }));
|
|
613
|
+
(0, fixtures_1.expect)(scrollHeight).toBeGreaterThan(clientHeight);
|
|
614
|
+
}));
|
|
615
|
+
(0, fixtures_1.test)(`overflowX="scroll"`, (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
616
|
+
yield initTestBed(`
|
|
617
|
+
<HStack testId="stack" width="100px" height="60px" backgroundColor="cyan"
|
|
618
|
+
overflowX="scroll">
|
|
619
|
+
<Text testId="item0">
|
|
620
|
+
As its container width and height are fixed, this long text does not
|
|
621
|
+
fit into it; it will overflow.
|
|
622
|
+
</Text>
|
|
623
|
+
</HStack>
|
|
624
|
+
`);
|
|
625
|
+
const { scrollWidth, clientWidth } = yield page
|
|
626
|
+
.getByTestId("stack")
|
|
627
|
+
.evaluate((elem) => ({ scrollWidth: elem.scrollWidth, clientWidth: elem.clientWidth }));
|
|
628
|
+
(0, fixtures_1.expect)(scrollWidth).toBeGreaterThan(clientWidth);
|
|
629
|
+
}));
|
|
630
|
+
// When you set overflowX to scroll, it will automatically set overflowY to scroll if the text exceeds the viewport vertically
|
|
631
|
+
(0, fixtures_1.test)(`overflowX sets overflowY`, (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
632
|
+
yield initTestBed(`
|
|
633
|
+
<VStack testId="stack" height="50px" width="300px" backgroundColor="cyan"
|
|
634
|
+
overflowX="scroll">
|
|
635
|
+
<Text width="400px" backgroundColor="silver" opacity="0.8">
|
|
636
|
+
This text sets its size explicitly bigger than its container.
|
|
637
|
+
As it does not fit into the container's viewport, it overflows.
|
|
638
|
+
However, its container supports horizontal scrolling so you can
|
|
639
|
+
see its content.
|
|
640
|
+
</Text>
|
|
641
|
+
</VStack>
|
|
642
|
+
`);
|
|
643
|
+
const { scrollHeight, clientHeight, scrollWidth, clientWidth } = yield page
|
|
644
|
+
.getByTestId("stack")
|
|
645
|
+
.evaluate((elem) => ({
|
|
646
|
+
scrollHeight: elem.scrollHeight,
|
|
647
|
+
clientHeight: elem.clientHeight,
|
|
648
|
+
scrollWidth: elem.scrollWidth,
|
|
649
|
+
clientWidth: elem.clientWidth,
|
|
650
|
+
}));
|
|
651
|
+
(0, fixtures_1.expect)(scrollWidth).toBeGreaterThan(clientWidth);
|
|
652
|
+
(0, fixtures_1.expect)(scrollHeight).toBeGreaterThan(clientHeight);
|
|
653
|
+
}));
|
|
654
|
+
});
|