* Gets the tertiary line text of the list item. Null if the list item * does not have a tertiary line.
()
| 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> { |