angular/components

bug(MatTree): MatTreeHarness with NestedTreeControl returns wrong structure

Chiusa

#23.881 aperta il 3 nov 2021

 (2 commenti) (0 reazioni) (0 assegnatari)TypeScript (6650 fork)batch import
P3area: cdk/treehelp wanted

Metriche repository

Star
 (24.044 stelle)
Metriche merge PR
 (Merge medio 3g 12h) (98 PR mergiate in 30 g)

Descrizione

Reproduction

Steps to reproduce:

  1. Create a MatTreeComponent with a NestedTreeControl and MatTreeNestedDatasource
  2. Test the component structure

https://stackblitz.com/edit/harness-issue-xgqlpl?file=src/app/tree-harness-example.spec.ts

Expected Behavior

The structure should have as many children (2 in the Stackblitz example) as visible Nodes.

{ children: [ { text: "Group 1"}, { text: "Group 2"} ] }

Actual Behavior

The structure has only one children without text.

{ children: [ { text: ""} ] }

Environment

  • Angular: 12.2.12
  • CDK/Material: 12.2.12
  • Browser(s): Test Environment
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows

Guida contributor