Add tests for LayoutableChildren iterator #1731

Closed
j-piasecki wants to merge 1 commits from @jpiasecki/layoutable_children_tests into main
j-piasecki commented 2024-10-25 01:33:27 -07:00 (Migrated from github.com)

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

flowchart TD
R((R)) --> A((A))
R --> B((B))
R --> C((C))

B --> D((D))
B --> E((E))

style B fill:#090

Correct order: A, D, E, C

Multiple display: contents nodes

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:#090
style B fill:#090
style C fill:#090

Correct order: D, E, F, G, H, I

Nested display: contents nodes

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:#090
style E fill:#090

Correct order: A, D, F, G, C

Leaf display: contents node

flowchart TD
R((R)) --> A((A))
R --> B((B))
R --> C((C))

style B fill:#090

Correct order: A, C

Root display: contents node

flowchart TD
R((R)) --> A((A))
R --> B((B))
R --> C((C))

style R fill:#090

Correct order: A, B, C - LayoutableChildren goes over the children with display: contents property, setting it on the root node should have no effect.

## 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:#090 ``` 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:#090 style B fill:#090 style C fill:#090 ``` 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:#090 style E fill:#090 ``` 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:#090 ``` Correct order: `A, C` ### Root `display: contents` node ```mermaid flowchart TD R((R)) --> A((A)) R --> B((B)) R --> C((C)) style R fill:#090 ``` Correct order: `A, B, C` - `LayoutableChildren` goes over the children with `display: contents` property, setting it on the root node should have no effect.
vercel[bot] commented 2024-10-25 01:33:32 -07:00 (Migrated from github.com)

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
yoga-website Ready (Inspect) Visit Preview 💬 Add feedback Oct 25, 2024 8:36am
[vc]: #Hs3nBRSnSICLPHyrPNwysWX3WX2l/mOYyXMZFJf9CGo=:eyJpc01vbm9yZXBvIjp0cnVlLCJ0eXBlIjoiZ2l0aHViIiwicHJvamVjdHMiOlt7Im5hbWUiOiJ5b2dhLXdlYnNpdGUiLCJyb290RGlyZWN0b3J5Ijoid2Vic2l0ZSIsImluc3BlY3RvclVybCI6Imh0dHBzOi8vdmVyY2VsLmNvbS9mYm9wZW5zb3VyY2UveW9nYS13ZWJzaXRlLzNHVWhQVlZEOW5DYXRaWlk1VVFZdkJWOFE1elIiLCJwcmV2aWV3VXJsIjoieW9nYS13ZWJzaXRlLWdpdC1mb3JrLWotcGlhc2Vja2ktanBpYXNlY2tpLWNkODRkZS1mYm9wZW5zb3VyY2UudmVyY2VsLmFwcCIsIm5leHRDb21taXRTdGF0dXMiOiJERVBMT1lFRCIsImxpdmVGZWVkYmFjayI6eyJyZXNvbHZlZCI6MCwidW5yZXNvbHZlZCI6MCwidG90YWwiOjAsImxpbmsiOiJ5b2dhLXdlYnNpdGUtZ2l0LWZvcmstai1waWFzZWNraS1qcGlhc2Vja2ktY2Q4NGRlLWZib3BlbnNvdXJjZS52ZXJjZWwuYXBwIn19XX0= **The latest updates on your projects**. Learn more about [Vercel for Git ↗︎](https://vercel.link/github-learn-more) | Name | Status | Preview | Comments | Updated (UTC) | | :--- | :----- | :------ | :------- | :------ | | **yoga-website** | ✅ Ready ([Inspect](https://vercel.com/fbopensource/yoga-website/3GUhPVVD9nCatZZY5UQYvBV8Q5zR)) | [Visit Preview](https://vercel.live/open-feedback/yoga-website-git-fork-j-piasecki-jpiasecki-cd84de-fbopensource.vercel.app?via=pr-comment-visit-preview-link&passThrough=1) | 💬 [**Add feedback**](https://vercel.live/open-feedback/yoga-website-git-fork-j-piasecki-jpiasecki-cd84de-fbopensource.vercel.app?via=pr-comment-feedback-link) | Oct 25, 2024 8:36am |
facebook-github-bot commented 2024-10-25 11:37:14 -07:00 (Migrated from github.com)

@NickGerleman has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@NickGerleman has imported this pull request. If you are a Meta employee, you can view this diff [on Phabricator](https://www.internalfb.com/diff/D64981779).
facebook-github-bot commented 2024-10-25 18:04:48 -07:00 (Migrated from github.com)

@NickGerleman merged this pull request in facebook/yoga@6fed4dfe30.

@NickGerleman merged this pull request in facebook/yoga@6fed4dfe3053e9b3a6aac354dc8b0915976f85ec.

Pull request closed

Sign in to join this conversation.
No description provided.