1 | /**
|
---|
2 | * @license
|
---|
3 | * Copyright Google LLC All Rights Reserved.
|
---|
4 | *
|
---|
5 | * Use of this source code is governed by an MIT-style license that can be
|
---|
6 | * found in the LICENSE file at https://angular.io/license
|
---|
7 | */
|
---|
8 | import { ComponentHarness, HarnessPredicate } from '@angular/cdk/testing';
|
---|
9 | import { MatTreeNodeHarness } from './node-harness';
|
---|
10 | import { TreeHarnessFilters, TreeNodeHarnessFilters } from './tree-harness-filters';
|
---|
11 | export declare type TextTree = {
|
---|
12 | text?: string;
|
---|
13 | children?: TextTree[];
|
---|
14 | };
|
---|
15 | /** Harness for interacting with a standard mat-tree in tests. */
|
---|
16 | export declare class MatTreeHarness extends ComponentHarness {
|
---|
17 | /** The selector for the host element of a `MatTableHarness` instance. */
|
---|
18 | static hostSelector: string;
|
---|
19 | /**
|
---|
20 | * Gets a `HarnessPredicate` that can be used to search for a tree with specific attributes.
|
---|
21 | * @param options Options for narrowing the search
|
---|
22 | * @return a `HarnessPredicate` configured with the given options.
|
---|
23 | */
|
---|
24 | static with(options?: TreeHarnessFilters): HarnessPredicate<MatTreeHarness>;
|
---|
25 | /** Gets all of the nodes in the tree. */
|
---|
26 | getNodes(filter?: TreeNodeHarnessFilters): Promise<MatTreeNodeHarness[]>;
|
---|
27 | /**
|
---|
28 | * Gets an object representation for the visible tree structure
|
---|
29 | * If a node is under an unexpanded node it will not be included.
|
---|
30 | * Eg.
|
---|
31 | * Tree (all nodes expanded):
|
---|
32 | * `
|
---|
33 | * <mat-tree>
|
---|
34 | * <mat-tree-node>Node 1<mat-tree-node>
|
---|
35 | * <mat-nested-tree-node>
|
---|
36 | * Node 2
|
---|
37 | * <mat-nested-tree-node>
|
---|
38 | * Node 2.1
|
---|
39 | * <mat-tree-node>
|
---|
40 | * Node 2.1.1
|
---|
41 | * <mat-tree-node>
|
---|
42 | * <mat-nested-tree-node>
|
---|
43 | * <mat-tree-node>
|
---|
44 | * Node 2.2
|
---|
45 | * <mat-tree-node>
|
---|
46 | * <mat-nested-tree-node>
|
---|
47 | * </mat-tree>`
|
---|
48 | *
|
---|
49 | * Tree structure:
|
---|
50 | * {
|
---|
51 | * children: [
|
---|
52 | * {
|
---|
53 | * text: 'Node 1',
|
---|
54 | * children: [
|
---|
55 | * {
|
---|
56 | * text: 'Node 2',
|
---|
57 | * children: [
|
---|
58 | * {
|
---|
59 | * text: 'Node 2.1',
|
---|
60 | * children: [{text: 'Node 2.1.1'}]
|
---|
61 | * },
|
---|
62 | * {text: 'Node 2.2'}
|
---|
63 | * ]
|
---|
64 | * }
|
---|
65 | * ]
|
---|
66 | * }
|
---|
67 | * ]
|
---|
68 | * };
|
---|
69 | */
|
---|
70 | getTreeStructure(): Promise<TextTree>;
|
---|
71 | /**
|
---|
72 | * Recursively collect the structured text of the tree nodes.
|
---|
73 | * @param nodes A list of tree nodes
|
---|
74 | * @param level The level of nodes that are being accounted for during this iteration
|
---|
75 | * @param parentExpanded Whether the parent of the first node in param nodes is expanded
|
---|
76 | */
|
---|
77 | private _getTreeStructure;
|
---|
78 | private _addChildToNode;
|
---|
79 | }
|
---|