Skip to content

Commit

Permalink
ANDROID-15138 add disabled state catalog sample and test
Browse files Browse the repository at this point in the history
  • Loading branch information
yamal-alm committed Sep 6, 2024
1 parent 69a8470 commit e1746f6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ fun Inputs() {
Title("Disable Dropdown")
DropDownSample(enabled = false)
Title("Search Input")
SearchInputSample()
SearchInputSample(enabled = true)
SearchInputSample(enabled = false)
Title("Inverse inputs")
Column(
modifier = Modifier
Expand Down Expand Up @@ -450,7 +451,7 @@ private fun DropDownSample(enabled: Boolean = true) {
}

@Composable
private fun SearchInputSample() {
private fun SearchInputSample(enabled: Boolean) {
var text by remember {
mutableStateOf("")
}
Expand All @@ -464,6 +465,7 @@ private fun SearchInputSample() {
onValueChange = {
text = it
},
label = "Search Something"
label = "Search Something",
enabled = enabled,
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ class SearchInputTest : ScreenshotsTest() {
thenScreenshotIsOk()
}

@Test
fun `disabled SearchInput`() {
givenSomeSearchInput(value = "", enabled = false)

thenScreenshotIsOk()
}

@Test
fun `SearchInput is cleared when clicking on clear search button`() {
givenSomeSearchInput(value = "Something")
Expand All @@ -40,13 +47,14 @@ class SearchInputTest : ScreenshotsTest() {
thenScreenshotIsOk()
}

private fun givenSomeSearchInput(value: String) {
private fun givenSomeSearchInput(value: Strin, enabled: Boolean = true) {
composeTestRule.setContent {
MisticaTheme(brand = MovistarBrand) {
SearchInput(
value = value,
onValueChange = { },
label = "Search something",
enabled = enabled
)
}
}
Expand Down

0 comments on commit e1746f6

Please sign in to comment.