Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,7 @@ public open class ReactAccessibilityDelegate( // The View this delegate is attac
}
}

/** Returns the matching role, or [NONE] when [value] is null or unrecognized. */
@JvmStatic
public fun fromValue(value: String?): AccessibilityRole {
if (value == null) {
Expand All @@ -510,7 +511,7 @@ public open class ReactAccessibilityDelegate( // The View this delegate is attac
return role
}
}
throw IllegalArgumentException("Invalid accessibility role value: $value")
return NONE
}

@JvmStatic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,13 @@ class ReactAccessibilityDelegateTest {
.isEqualTo("android.view.View")
}

@Test
fun testAccessibilityRole_fromValue_invalidRole_returnsNone() {
val role = ReactAccessibilityDelegate.AccessibilityRole.fromValue("invalid-role")

assertThat(role).isEqualTo(ReactAccessibilityDelegate.AccessibilityRole.NONE)
}

@Test
fun testPerformAccessibilityAction_collapseAction_fromAccessibilityActions() {
val accessibilityActions = JavaOnlyArray()
Expand Down
Loading