mirror of
https://github.com/hanzoai/yoga.git
synced 2026-10-30 19:34:29 +00:00
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.
83 lines
2.5 KiB
TypeScript
83 lines
2.5 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<<f07bbe4cbd3a7bce6133698998fef50f>>
|
|
* generated by gentest/src/GentestDriver.ts from gentest/fixtures/grid_percent_items_nested_with_margin.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_percent_items_nested_with_margin', () => {
|
|
const config = Yoga.Config.create();
|
|
|
|
const root = Yoga.Node.create(config);
|
|
root.setPositionType(PositionType.Absolute);
|
|
root.setDisplay(Display.Grid);
|
|
root.setWidth(200);
|
|
|
|
const root_child0 = Yoga.Node.create(config);
|
|
root_child0.setDisplay(Display.Grid);
|
|
root_child0.setWidth("50%");
|
|
root.insertChild(root_child0, 0);
|
|
|
|
const root_child0_child0 = Yoga.Node.create(config);
|
|
root_child0_child0.setWidth("45%");
|
|
root_child0_child0.setMargin(Edge.All, "5%");
|
|
root_child0.insertChild(root_child0_child0, 0);
|
|
root.calculateLayout(undefined, undefined, Direction.LTR);
|
|
|
|
expect(root.getComputedLeft()).toBe(0);
|
|
expect(root.getComputedTop()).toBe(0);
|
|
expect(root.getComputedWidth()).toBe(200);
|
|
expect(root.getComputedHeight()).toBe(0);
|
|
|
|
expect(root_child0.getComputedLeft()).toBe(0);
|
|
expect(root_child0.getComputedTop()).toBe(0);
|
|
expect(root_child0.getComputedWidth()).toBe(0);
|
|
expect(root_child0.getComputedHeight()).toBe(0);
|
|
|
|
expect(root_child0_child0.getComputedLeft()).toBe(0);
|
|
expect(root_child0_child0.getComputedTop()).toBe(0);
|
|
expect(root_child0_child0.getComputedWidth()).toBe(0);
|
|
expect(root_child0_child0.getComputedHeight()).toBe(0);
|
|
|
|
root.calculateLayout(undefined, undefined, Direction.RTL);
|
|
|
|
expect(root.getComputedLeft()).toBe(0);
|
|
expect(root.getComputedTop()).toBe(0);
|
|
expect(root.getComputedWidth()).toBe(200);
|
|
expect(root.getComputedHeight()).toBe(0);
|
|
|
|
expect(root_child0.getComputedLeft()).toBe(200);
|
|
expect(root_child0.getComputedTop()).toBe(0);
|
|
expect(root_child0.getComputedWidth()).toBe(0);
|
|
expect(root_child0.getComputedHeight()).toBe(0);
|
|
|
|
expect(root_child0_child0.getComputedLeft()).toBe(0);
|
|
expect(root_child0_child0.getComputedTop()).toBe(0);
|
|
expect(root_child0_child0.getComputedWidth()).toBe(0);
|
|
expect(root_child0_child0.getComputedHeight()).toBe(0);
|
|
});
|