Skip to content

Commit 95cfa6a

Browse files
j-piaseckifacebook-github-bot
authored andcommitted
Add tests for LayoutableChildren iterator
Summary: Adds unit tests that directly cover the order in which `LayoutableChildren` iterator goes over the descendant nodes. The covered cases are as follows (nodes with `display: contents` are marked green): ### Single `display: contents` node ```mermaid flowchart TD R((R)) --> A((A)) R --> B((B)) R --> C((C)) B --> D((D)) B --> E((E)) style B fill:facebook/yoga#90 ``` Correct order: `A, D, E, C` ### Multiple `display: contents` nodes ```mermaid flowchart TD R((R)) --> A((A)) R --> B((B)) R --> C((C)) A --> D((D)) A --> E((E)) B --> F((F)) B --> G((G)) C --> H((H)) C --> I((I)) style A fill:facebook/yoga#90 style B fill:facebook/yoga#90 style C fill:facebook/yoga#90 ``` Correct order: `D, E, F, G, H, I` ### Nested `display: contents` nodes ```mermaid flowchart TD R((R)) --> A((A)) R --> B((B)) R --> C((C)) B --> D((D)) B --> E((E)) E --> F((F)) E --> G((G)) style B fill:facebook/yoga#90 style E fill:facebook/yoga#90 ``` Correct order: `A, D, F, G, C` ### Leaf `display: contents` node ```mermaid flowchart TD R((R)) --> A((A)) R --> B((B)) R --> C((C)) style B fill:facebook/yoga#90 ``` Correct order: `A, C` ### Root `display: contents` node ```mermaid flowchart TD R((R)) --> A((A)) R --> B((B)) R --> C((C)) style R fill:facebook/yoga#90 ``` Correct order: `A, B, C` - `LayoutableChildren` goes over the children with `display: contents` property, setting it on the root node should have no effect. X-link: facebook/yoga#1731 Differential Revision: D64981779 Pulled By: NickGerleman
1 parent 3fff4cf commit 95cfa6a

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

packages/react-native/ReactCommon/yoga/yoga/node/LayoutableChildren.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*/
7+
#pragma once
78

89
#include <cstdint>
910
#include <vector>

0 commit comments

Comments
 (0)