Files
yoga/javascript/tests/generated/grid_minmax_auto_percent_definite.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

73 lines
2.3 KiB
TypeScript
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* 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<<1ecb9d12db5db6053ab3995b092cfcd0>>
* generated by gentest/src/GentestDriver.ts from gentest/fixtures/grid_minmax_auto_percent_definite.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_minmax_auto_percent_definite', () => {
const config = Yoga.Config.create();
const root = Yoga.Node.create(config);
root.setPositionType(PositionType.Absolute);
root.setDisplay(Display.Grid);
root.setWidth(100);
const rootGridTemplateColumns = [];
rootGridTemplateColumns.push({type: GridTrackType.Minmax, min: {type: GridTrackType.Auto}, max: {type: GridTrackType.Percent, value: 20}});
root.setGridTemplateColumns(rootGridTemplateColumns);
const rootGridTemplateRows = [];
rootGridTemplateRows.push({type: GridTrackType.Points, value: 40});
root.setGridTemplateRows(rootGridTemplateRows);
const root_child0 = Yoga.Node.create(config);
root.insertChild(root_child0, 0);
root_child0.setMeasureFunc(intrinsicSizeMeasureFunc.bind({text: "HH​HH", flexDirection: FlexDirection.Column}));
root.calculateLayout(undefined, undefined, Direction.LTR);
expect(root.getComputedLeft()).toBe(0);
expect(root.getComputedTop()).toBe(0);
expect(root.getComputedWidth()).toBe(100);
expect(root.getComputedHeight()).toBe(40);
expect(root_child0.getComputedLeft()).toBe(0);
expect(root_child0.getComputedTop()).toBe(0);
expect(root_child0.getComputedWidth()).toBe(20);
expect(root_child0.getComputedHeight()).toBe(40);
root.calculateLayout(undefined, undefined, Direction.RTL);
expect(root.getComputedLeft()).toBe(0);
expect(root.getComputedTop()).toBe(0);
expect(root.getComputedWidth()).toBe(100);
expect(root.getComputedHeight()).toBe(40);
expect(root_child0.getComputedLeft()).toBe(80);
expect(root_child0.getComputedTop()).toBe(0);
expect(root_child0.getComputedWidth()).toBe(20);
expect(root_child0.getComputedHeight()).toBe(40);
});