File tree Expand file tree Collapse file tree
goldens/aria/grid/testing Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,7 +17,9 @@ export class GridCellHarness extends ContentContainerComponentHarness {
1717 getText(): Promise <string >;
1818 // (undocumented)
1919 static hostSelector: string ;
20+ isActive(): Promise <boolean >;
2021 isDisabled(): Promise <boolean >;
22+ isFocused(): Promise <boolean >;
2123 isSelected(): Promise <boolean >;
2224 static with(options ? : GridCellHarnessFilters ): HarnessPredicate <GridCellHarness >;
2325}
Original file line number Diff line number Diff line change @@ -97,6 +97,19 @@ describe('Grid Harness', () => {
9797 const rows = await loader . getAllHarnesses ( GridRowHarness ) ;
9898 expect ( await rows [ 0 ] . getCellTextByIndex ( ) ) . toEqual ( [ 'Cell 1.1' , 'Cell 1.2' ] ) ;
9999 } ) ;
100+
101+ it ( 'reports the active state of a cell' , async ( ) => {
102+ const cell = await loader . getHarness ( GridCellHarness . with ( { text : 'Cell 1.1' } ) ) ;
103+ expect ( await cell . isActive ( ) ) . toBeTrue ( ) ;
104+ } ) ;
105+
106+ it ( 'reports the focused state of a cell' , async ( ) => {
107+ const cell = await loader . getHarness ( GridCellHarness . with ( { text : 'Cell 1.1' } ) ) ;
108+ expect ( await cell . isFocused ( ) ) . toBeFalse ( ) ;
109+
110+ await cell . focus ( ) ;
111+ expect ( await cell . isFocused ( ) ) . toBeTrue ( ) ;
112+ } ) ;
100113} ) ;
101114
102115@Component ( {
Original file line number Diff line number Diff line change @@ -79,6 +79,18 @@ export class GridCellHarness extends ContentContainerComponentHarness {
7979 const host = await this . host ( ) ;
8080 return host . blur ( ) ;
8181 }
82+
83+ /** Whether the cell is active. */
84+ async isActive ( ) : Promise < boolean > {
85+ const host = await this . host ( ) ;
86+ return ( await host . getAttribute ( 'data-active' ) ) === 'true' ;
87+ }
88+
89+ /** Whether the cell is focused. */
90+ async isFocused ( ) : Promise < boolean > {
91+ const host = await this . host ( ) ;
92+ return host . isFocused ( ) ;
93+ }
8294}
8395
8496/** Harness for interacting with a standard ngGridRow in tests. */
You can’t perform that action at this time.
0 commit comments