Teach test generator gap/row-gap/column-gap

Summary:
This adds mappings to the test generator to create the right language specific calls when an HTML fixture has gap properties.

Changelog:
[Internal][Added] - Teach yoga test generator gap/row-gap/column-gap

Reviewed By: javache

Differential Revision: D39922409

fbshipit-source-id: 5b905ed95ae64373d2c7d3bb1a03e94270bf209a
This commit is contained in:
Nick Gerleman
2022-10-13 08:18:49 -07:00
committed by Facebook GitHub Bot
parent f992e63ac5
commit 8e29e7c1e1
5 changed files with 45 additions and 0 deletions

View File

@@ -165,6 +165,15 @@ function setupTestTree(e, parent, node, genericNode, nodeName, parentName, index
if (!isDefaultStyleValue(style, node.style[style])) {
switch (style) {
case 'gap':
e.YGNodeStyleSetGap(nodeName, e.YGGutterAll, pointValue(e, node.style[style]));
break;
case 'column-gap':
e.YGNodeStyleSetGap(nodeName, e.YGGutterColumn, pointValue(e, node.style[style]));
break;
case 'row-gap':
e.YGNodeStyleSetGap(nodeName, e.YGGutterRow, pointValue(e, node.style[style]));
break;
case 'direction':
e.YGNodeStyleSetDirection(nodeName, directionValue(e, node.style[style]));
break;
@@ -477,6 +486,8 @@ function calculateTree(root, roundToPixelGrid) {
}
function getYogaStyle(node) {
// TODO: Relying on computed style means we cannot test shorthand props like
// "padding", "margin", "gap".
return [
'direction',
'flex-direction',
@@ -512,6 +523,8 @@ function getYogaStyle(node) {
'height',
'min-height',
'max-height',
'column-gap',
'row-gap',
'display',
].reduce(function(map, key) {
map[key] = node.style[key] || getComputedStyle(node, null).getPropertyValue(key);