generated from vextorspace/KotlinMultiplatformTesting
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test that itemcardmaker actually displays content
- Loading branch information
1 parent
cda77d9
commit 815acc0
Showing
3 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
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
36 changes: 36 additions & 0 deletions
36
composeApp/src/desktopTest/kotlin/view/ItemCardMakerTest.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package view | ||
|
||
import androidx.compose.runtime.mutableStateOf | ||
import androidx.compose.ui.test.ExperimentalTestApi | ||
import androidx.compose.ui.test.assertIsDisplayed | ||
import androidx.compose.ui.test.onNodeWithText | ||
import androidx.compose.ui.test.runComposeUiTest | ||
import model.Item | ||
import org.junit.Test | ||
|
||
class ItemCardMakerTest { | ||
|
||
@OptIn(ExperimentalTestApi::class) | ||
@Test | ||
fun testItemCardMakerIncludesContent() = runComposeUiTest { | ||
val itemContent = "::ITEMS CONTENT::" | ||
val item = Item(itemContent) | ||
val parentItems = mutableListOf<Item>() | ||
val parentItemsState = mutableStateOf(parentItems) | ||
val selectedCard = mutableStateOf<Item?>(null) | ||
val statusText = mutableStateOf("") | ||
|
||
setContent { | ||
ItemCardMaker( | ||
item, | ||
parentItems, | ||
parentItemsState, | ||
selectedCard, | ||
statusText | ||
).Compose() | ||
} | ||
|
||
onNodeWithText(itemContent) | ||
.assertIsDisplayed() | ||
} | ||
} |
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