MCPcopy Create free account
hub / github.com/angular/components / getTertiaryText

Function getTertiaryText

src/material/list/testing/list-item-harness-base.ts:165–187  ·  view source on GitHub ↗

* Gets the tertiary line text of the list item. Null if the list item * does not have a tertiary line.

()

Source from the content-addressed store, hash-verified

163 * does not have a tertiary line.
164 */
165 async getTertiaryText(): Promise<string | null> {
166 const type = await this.getType();
167 if (type !== MatListItemType.THREE_LINE_ITEM) {
168 return null;
169 }
170
171 const [lines, unscopedTextContent] = await parallel(() => [
172 this._lines(),
173 this._unscopedTextContent(),
174 ]);
175
176 // First we check if there is an explicit line for the tertiary text. If so, we return it.
177 // If there is at least an explicit secondary line though, then we know that the unscoped
178 // text content corresponds to the tertiary line. If there are no explicit lines at all,
179 // we know that the unscoped text content from the secondary text just wraps into the third
180 // line, but there *no* actual dedicated tertiary text.
181 if (lines.length === 2) {
182 return lines[1].text();
183 } else if (lines.length === 1) {
184 return unscopedTextContent.text();
185 }
186 return null;
187 }
188
189 /** Whether this list item has an avatar. */
190 async hasAvatar(): Promise<boolean> {

Callers

nothing calls this directly

Calls 3

parallelFunction · 0.90
textMethod · 0.65
getTypeMethod · 0.45

Tested by

no test coverage detected