File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed
src/material/tabs/testing Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -99,6 +99,7 @@ export function runHarnessTests(
99
99
it ( 'should be able to get harness loader for content element of active tab' , async ( ) => {
100
100
const tabGroup = await loader . getHarness ( tabGroupHarness ) ;
101
101
const tabs = await tabGroup . getTabs ( ) ;
102
+ expect ( await tabs [ 0 ] . getTextContent ( ) ) . toBe ( 'Content 1' ) ;
102
103
const tabContentLoader = await tabs [ 0 ] . getHarnessLoaderForContent ( ) ;
103
104
const tabContentHarness = await tabContentLoader . getHarness ( TestTabContentHarness ) ;
104
105
expect ( await ( await tabContentHarness . host ( ) ) . text ( ) ) . toBe ( 'Content 1' ) ;
Original file line number Diff line number Diff line change @@ -60,6 +60,13 @@ export class MatTabHarness extends ComponentHarness {
60
60
await ( await this . host ( ) ) . click ( ) ;
61
61
}
62
62
63
+ /** Gets the text content of the tab. */
64
+ async getTextContent ( ) : Promise < string > {
65
+ const contentId = await this . _getContentId ( ) ;
66
+ const contentEl = await this . documentRootLocatorFactory ( ) . locatorFor ( `#${ contentId } ` ) ( ) ;
67
+ return contentEl . text ( ) ;
68
+ }
69
+
63
70
/**
64
71
* Gets a `HarnessLoader` that can be used to load harnesses for components within the tab's
65
72
* content area.
You can’t perform that action at this time.
0 commit comments