You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
79 lines
2.6 KiB
79 lines
2.6 KiB
/**
|
|
* @license
|
|
* Copyright Google LLC All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
* found in the LICENSE file at https://angular.io/license
|
|
*/
|
|
import { ComponentHarness, HarnessPredicate } from '@angular/cdk/testing';
|
|
import { MatTreeNodeHarness } from './node-harness';
|
|
import { TreeHarnessFilters, TreeNodeHarnessFilters } from './tree-harness-filters';
|
|
export declare type TextTree = {
|
|
text?: string;
|
|
children?: TextTree[];
|
|
};
|
|
/** Harness for interacting with a standard mat-tree in tests. */
|
|
export declare class MatTreeHarness extends ComponentHarness {
|
|
/** The selector for the host element of a `MatTableHarness` instance. */
|
|
static hostSelector: string;
|
|
/**
|
|
* Gets a `HarnessPredicate` that can be used to search for a tree with specific attributes.
|
|
* @param options Options for narrowing the search
|
|
* @return a `HarnessPredicate` configured with the given options.
|
|
*/
|
|
static with(options?: TreeHarnessFilters): HarnessPredicate<MatTreeHarness>;
|
|
/** Gets all of the nodes in the tree. */
|
|
getNodes(filter?: TreeNodeHarnessFilters): Promise<MatTreeNodeHarness[]>;
|
|
/**
|
|
* Gets an object representation for the visible tree structure
|
|
* If a node is under an unexpanded node it will not be included.
|
|
* Eg.
|
|
* Tree (all nodes expanded):
|
|
* `
|
|
* <mat-tree>
|
|
* <mat-tree-node>Node 1<mat-tree-node>
|
|
* <mat-nested-tree-node>
|
|
* Node 2
|
|
* <mat-nested-tree-node>
|
|
* Node 2.1
|
|
* <mat-tree-node>
|
|
* Node 2.1.1
|
|
* <mat-tree-node>
|
|
* <mat-nested-tree-node>
|
|
* <mat-tree-node>
|
|
* Node 2.2
|
|
* <mat-tree-node>
|
|
* <mat-nested-tree-node>
|
|
* </mat-tree>`
|
|
*
|
|
* Tree structure:
|
|
* {
|
|
* children: [
|
|
* {
|
|
* text: 'Node 1',
|
|
* children: [
|
|
* {
|
|
* text: 'Node 2',
|
|
* children: [
|
|
* {
|
|
* text: 'Node 2.1',
|
|
* children: [{text: 'Node 2.1.1'}]
|
|
* },
|
|
* {text: 'Node 2.2'}
|
|
* ]
|
|
* }
|
|
* ]
|
|
* }
|
|
* ]
|
|
* };
|
|
*/
|
|
getTreeStructure(): Promise<TextTree>;
|
|
/**
|
|
* Recursively collect the structured text of the tree nodes.
|
|
* @param nodes A list of tree nodes
|
|
* @param level The level of nodes that are being accounted for during this iteration
|
|
* @param parentExpanded Whether the parent of the first node in param nodes is expanded
|
|
*/
|
|
private _getTreeStructure;
|
|
private _addChildToNode;
|
|
}
|