Updated on 2026-08-14
This commit is contained in:
parent
e0feda9a00
commit
fda7f64fd9
1 changed files with 1 additions and 1 deletions
|
|
@ -9,7 +9,7 @@ import androidx.compose.ui.test.assertIsDisplayed
|
||||||
/** Returns the first non-blank text found in this node or its subtree (unmerged tree). */
|
/** Returns the first non-blank text found in this node or its subtree (unmerged tree). */
|
||||||
fun SemanticsNode.firstTextOrNull(): String? {
|
fun SemanticsNode.firstTextOrNull(): String? {
|
||||||
config.getOrNull(SemanticsProperties.Text)
|
config.getOrNull(SemanticsProperties.Text)
|
||||||
?.firstOrNull()?.text?.toString()?.takeIf { it.isNotBlank() }
|
?.firstOrNull()?.text?.takeIf { it.isNotBlank() }
|
||||||
?.let { return it }
|
?.let { return it }
|
||||||
children.forEach { child -> child.firstTextOrNull()?.let { return it } }
|
children.forEach { child -> child.firstTextOrNull()?.let { return it } }
|
||||||
return null
|
return null
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue