-
-
Save eevajonnapanula/1444e0898a0a5f5b662764e284bb3b38 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SelectableTest { | |
@get:Rule | |
val composeTestRule = createComposeRule() | |
@Before | |
fun setup() { | |
composeTestRule.setContent { | |
ModifiersExampleTheme { | |
SelectableScreen() | |
} | |
} | |
} | |
@Test | |
fun hasRoleNameValue() { | |
val selectableElements = | |
composeTestRule.onAllNodes(hasTestTag("accessible-selectable")) | |
// Assert accessible name | |
selectableElements[0].assertTextEquals("Option A") | |
selectableElements[1].assertTextEquals("Option B") | |
// Assert role | |
selectableElements.assertAll(isSelectable()) | |
// Assert value | |
selectableElements[0].assertIsSelected() | |
selectableElements[1].performClick() | |
selectableElements[0].assertIsNotSelected() | |
selectableElements[1].assertIsSelected() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment