@@ -14,31 +14,43 @@ import {
14
14
import { TreeNodeHarnessFilters } from './tree-harness-filters' ;
15
15
import { coerceBooleanProperty , coerceNumberProperty } from '@angular/cdk/coercion' ;
16
16
17
+ /** Harness for interacting with a standard Angular Material tree node. */
17
18
export class MatTreeNodeHarness extends ComponentHarness {
19
+ /** The selector of the host element of a `MatTreeNode` instance. */
18
20
static hostSelector = '.mat-tree-node' ;
19
21
20
22
_toggle = this . locatorForOptional ( 'mattreenodetoggle' ) ;
21
23
24
+ /**
25
+ * Gets a `HarnessPredicate` that can be used to search for a tree node with specific attributes.
26
+ * @param options Options for narrowing the search
27
+ * @return a `HarnessPredicate` configured with the given options.
28
+ */
22
29
static with ( options : TreeNodeHarnessFilters = { } ) : HarnessPredicate < MatTreeNodeHarness > {
23
30
return getNodePredicate ( MatTreeNodeHarness , options ) ;
24
31
}
25
32
33
+ /** Whether the tree node is expanded. */
26
34
async isExpanded ( ) : Promise < boolean > {
27
35
return coerceBooleanProperty ( await ( await this . host ( ) ) . getAttribute ( 'aria-expanded' ) ) ;
28
36
}
29
37
38
+ /** Whether the tree node is disabled. */
30
39
async isDisabled ( ) : Promise < boolean > {
31
40
return coerceBooleanProperty ( await ( await this . host ( ) ) . getProperty ( 'aria-disabled' ) ) ;
32
41
}
33
42
43
+ /** Gets the level of the tree node.. */
34
44
async getLevel ( ) : Promise < number > {
35
45
return coerceNumberProperty ( await ( await this . host ( ) ) . getAttribute ( 'aria-level' ) ) ;
36
46
}
37
47
48
+ /** Gets the role of the tree node. 'group' or 'treeitem' */
38
49
async getRole ( ) : Promise < string | null > {
39
50
return ( await this . host ( ) ) . getAttribute ( 'role' ) ;
40
51
}
41
52
53
+ /** Gets the tree node's text. */
42
54
async getText ( ) : Promise < string > {
43
55
return ( await this . host ( ) ) . text ( ) ;
44
56
}
@@ -51,9 +63,17 @@ export class MatTreeNodeHarness extends ComponentHarness {
51
63
}
52
64
}
53
65
66
+ /** Harness for interacting with a standard Angular Material nested tree node. */
54
67
export class MatNestedTreeNodeHarness extends MatTreeNodeHarness {
68
+ /** The selector for the host element of a `MatNestedTreeNode` instance. */
55
69
static hostSelector = '.mat-nested-tree-node' ;
56
70
71
+ /**
72
+ * Gets a `HarnessPredicate` that can be used to search for
73
+ * a nested tree node with specific attributes.
74
+ * @param options Options for narrowing the search
75
+ * @return a `HarnessPredicate` configured with the given options.
76
+ */
57
77
static with ( options : TreeNodeHarnessFilters = { } ) : HarnessPredicate < MatNestedTreeNodeHarness > {
58
78
return getNodePredicate ( MatNestedTreeNodeHarness , options ) ;
59
79
}
0 commit comments