Skip to content

Commit 39f861c

Browse files
committed
Add test in CrossFadeTest.kt
1 parent 0b8be29 commit 39f861c

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

core/ui/src/androidTest/java/io/jja08111/gemini/core/ui/CrossFadeTest.kt

+20
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,26 @@ class CrossFadeTest {
3636
composeRule.onNodeWithText(SECOND_TITLE).assertIsDisplayed()
3737
}
3838

39+
@Test
40+
fun shouldSwitchToFirstComponent() {
41+
var showFirst by mutableStateOf(false)
42+
composeRule.setContent {
43+
CrossFade(
44+
showFirst = showFirst,
45+
firstContent = { FirstComponent() },
46+
secondContent = { SecondComponent() },
47+
)
48+
}
49+
50+
composeRule.onNodeWithText(FIRST_TITLE).assertIsNotDisplayed()
51+
composeRule.onNodeWithText(SECOND_TITLE).assertIsDisplayed()
52+
53+
showFirst = true
54+
55+
composeRule.onNodeWithText(FIRST_TITLE).assertIsDisplayed()
56+
composeRule.onNodeWithText(SECOND_TITLE).assertIsNotDisplayed()
57+
}
58+
3959
@Suppress("TestFunctionName")
4060
@Composable
4161
private fun FirstComponent() {

0 commit comments

Comments
 (0)