Files
yoga/javascript/tests/generated/grid_expand_flexible_indefinite_free_space.test.ts
zeekay 1c508dd3df publish the JavaScript package as @hanzo/layout 3.3.0
The package name is also the specifier every test and the playground import, so
it moves as one piece: package.json, the tsconfig path, the generator, and the
website workspace that depends on it. Generated tests are re-signed.

Dated blog posts keep the old name - they are a record of upstream's 2.0 and 3.0
releases, not instructions for this package.
2026-08-28 11:58:17 -07:00

120 lines
4.4 KiB
TypeScript

/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<f58e82f4ba3d3626d17a4dc29665b441>>
* generated by gentest/src/GentestDriver.ts from gentest/fixtures/grid_expand_flexible_indefinite_free_space.html
*/
import { intrinsicSizeMeasureFunc } from '../tools/utils.ts'
import Yoga from '@hanzo/layout';
import {
Align,
BoxSizing,
Direction,
Display,
Edge,
Errata,
ExperimentalFeature,
FlexDirection,
GridTrackType,
Gutter,
Justify,
MeasureMode,
Overflow,
PositionType,
Unit,
Wrap,
} from '@hanzo/layout';
test('grid_expand_flexible_indefinite_free_space_container', () => {
const config = Yoga.Config.create();
const root = Yoga.Node.create(config);
root.setPositionType(PositionType.Absolute);
root.setWidth("max-content");
const root_child0 = Yoga.Node.create(config);
root_child0.setDisplay(Display.Grid);
const root_child0GridTemplateColumns = [];
root_child0GridTemplateColumns.push({type: GridTrackType.Fr, value: 1});
root_child0GridTemplateColumns.push({type: GridTrackType.Fr, value: 2});
root_child0GridTemplateColumns.push({type: GridTrackType.Fr, value: 1});
root_child0.setGridTemplateColumns(root_child0GridTemplateColumns);
const root_child0GridTemplateRows = [];
root_child0GridTemplateRows.push({type: GridTrackType.Fr, value: 1});
root_child0GridTemplateRows.push({type: GridTrackType.Fr, value: 2});
root_child0.setGridTemplateRows(root_child0GridTemplateRows);
root.insertChild(root_child0, 0);
const root_child0_child0 = Yoga.Node.create(config);
root_child0_child0.setWidth(100);
root_child0_child0.setHeight(80);
root_child0.insertChild(root_child0_child0, 0);
const root_child0_child1 = Yoga.Node.create(config);
root_child0_child1.setWidth(150);
root_child0_child1.setHeight(120);
root_child0.insertChild(root_child0_child1, 1);
const root_child0_child2 = Yoga.Node.create(config);
root_child0_child2.setWidth(120);
root_child0_child2.setHeight(100);
root_child0.insertChild(root_child0_child2, 2);
root.calculateLayout(undefined, undefined, Direction.LTR);
expect(root.getComputedLeft()).toBe(0);
expect(root.getComputedTop()).toBe(0);
expect(root.getComputedWidth()).toBe(480);
expect(root.getComputedHeight()).toBe(360);
expect(root_child0.getComputedLeft()).toBe(0);
expect(root_child0.getComputedTop()).toBe(0);
expect(root_child0.getComputedWidth()).toBe(480);
expect(root_child0.getComputedHeight()).toBe(360);
expect(root_child0_child0.getComputedLeft()).toBe(0);
expect(root_child0_child0.getComputedTop()).toBe(0);
expect(root_child0_child0.getComputedWidth()).toBe(100);
expect(root_child0_child0.getComputedHeight()).toBe(80);
expect(root_child0_child1.getComputedLeft()).toBe(120);
expect(root_child0_child1.getComputedTop()).toBe(0);
expect(root_child0_child1.getComputedWidth()).toBe(150);
expect(root_child0_child1.getComputedHeight()).toBe(120);
expect(root_child0_child2.getComputedLeft()).toBe(360);
expect(root_child0_child2.getComputedTop()).toBe(0);
expect(root_child0_child2.getComputedWidth()).toBe(120);
expect(root_child0_child2.getComputedHeight()).toBe(100);
root.calculateLayout(undefined, undefined, Direction.RTL);
expect(root.getComputedLeft()).toBe(0);
expect(root.getComputedTop()).toBe(0);
expect(root.getComputedWidth()).toBe(480);
expect(root.getComputedHeight()).toBe(360);
expect(root_child0.getComputedLeft()).toBe(0);
expect(root_child0.getComputedTop()).toBe(0);
expect(root_child0.getComputedWidth()).toBe(480);
expect(root_child0.getComputedHeight()).toBe(360);
expect(root_child0_child0.getComputedLeft()).toBe(380);
expect(root_child0_child0.getComputedTop()).toBe(0);
expect(root_child0_child0.getComputedWidth()).toBe(100);
expect(root_child0_child0.getComputedHeight()).toBe(80);
expect(root_child0_child1.getComputedLeft()).toBe(210);
expect(root_child0_child1.getComputedTop()).toBe(0);
expect(root_child0_child1.getComputedWidth()).toBe(150);
expect(root_child0_child1.getComputedHeight()).toBe(120);
expect(root_child0_child2.getComputedLeft()).toBe(0);
expect(root_child0_child2.getComputedTop()).toBe(0);
expect(root_child0_child2.getComputedWidth()).toBe(120);
expect(root_child0_child2.getComputedHeight()).toBe(100);
});