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

83 lines
2.7 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<<bbd4e00a3aaf357a7ddb23f54f59cb0b>>
* generated by gentest/src/GentestDriver.ts from gentest/fixtures/grid_absolute_container_left_overrides_right.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_absolute_container_left_overrides_right', () => {
const config = Yoga.Config.create();
const root = Yoga.Node.create(config);
root.setPositionType(PositionType.Absolute);
root.setDisplay(Display.Grid);
const rootGridTemplateColumns = [];
rootGridTemplateColumns.push({type: GridTrackType.Points, value: 40});
rootGridTemplateColumns.push({type: GridTrackType.Points, value: 40});
rootGridTemplateColumns.push({type: GridTrackType.Points, value: 40});
root.setGridTemplateColumns(rootGridTemplateColumns);
const rootGridTemplateRows = [];
rootGridTemplateRows.push({type: GridTrackType.Points, value: 40});
rootGridTemplateRows.push({type: GridTrackType.Points, value: 40});
rootGridTemplateRows.push({type: GridTrackType.Points, value: 40});
root.setGridTemplateRows(rootGridTemplateRows);
root.setPadding(Edge.Top, 10);
root.setPadding(Edge.Right, 20);
root.setPadding(Edge.Bottom, 30);
root.setPadding(Edge.Left, 40);
const root_child0 = Yoga.Node.create(config);
root_child0.setPositionType(PositionType.Absolute);
root_child0.setPosition(Edge.Right, 2);
root_child0.setPosition(Edge.Left, 5);
root_child0.setWidth(10);
root.insertChild(root_child0, 0);
root.calculateLayout(undefined, undefined, Direction.LTR);
expect(root.getComputedLeft()).toBe(0);
expect(root.getComputedTop()).toBe(0);
expect(root.getComputedWidth()).toBe(180);
expect(root.getComputedHeight()).toBe(160);
expect(root_child0.getComputedLeft()).toBe(5);
expect(root_child0.getComputedTop()).toBe(0);
expect(root_child0.getComputedWidth()).toBe(10);
expect(root_child0.getComputedHeight()).toBe(0);
root.calculateLayout(undefined, undefined, Direction.RTL);
expect(root.getComputedLeft()).toBe(0);
expect(root.getComputedTop()).toBe(0);
expect(root.getComputedWidth()).toBe(180);
expect(root.getComputedHeight()).toBe(160);
expect(root_child0.getComputedLeft()).toBe(168);
expect(root_child0.getComputedTop()).toBe(0);
expect(root_child0.getComputedWidth()).toBe(10);
expect(root_child0.getComputedHeight()).toBe(0);
});