Skip to content

Commit

Permalink
Add unit test to check clear all button logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Siddharth Agarwal authored and siddh1004 committed Sep 16, 2024
1 parent 2c4dabe commit ac1c3ad
Showing 1 changed file with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,38 @@ class OrgBottomSheetTest {
rule.onNodeWithTag("ORG_TREE_ITEM_CHECKBOX_Item 1").assertExists()
rule.onNodeWithTag("ORG_TREE_ITEM_CHECKBOX_Item 2").assertDoesNotExist()
}

@Test
fun shouldHideClearButtonWhenOnClearAllMethodIsNotProvided() {
rule.setContent {
OrgBottomSheet(
orgTreeItems = listOf(
OrgTreeItem(
uid = "1",
label = "Item 1",
canBeSelected = true,
),
OrgTreeItem(
uid = "2",
label = "Item 2",
canBeSelected = false,
),
),
onDismiss = {
// no-op
},
onItemClick = {
// no-op
},
onItemSelected = { _, _ ->
// no-op
},
onDone = {
// no-op
},
)
}

rule.onNodeWithTag("CLEAR_ALL_BUTTON").assertDoesNotExist()
}
}

0 comments on commit ac1c3ad

Please sign in to comment.