mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-18 04:27:02 +05:30
REVERTME: copy preview code into tests
We wanna better mimic real behavior as opposed to this broken preview. Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
parent
bd6f7583c8
commit
841759ddd8
1 changed files with 8 additions and 5 deletions
|
@ -2,10 +2,8 @@ package dev.msfjarvis.todo
|
||||||
|
|
||||||
import androidx.ui.test.assertIsDisplayed
|
import androidx.ui.test.assertIsDisplayed
|
||||||
import androidx.ui.test.createComposeRule
|
import androidx.ui.test.createComposeRule
|
||||||
import androidx.ui.test.hasTestTag
|
|
||||||
import androidx.ui.test.onNode
|
|
||||||
import androidx.ui.test.onNodeWithText
|
import androidx.ui.test.onNodeWithText
|
||||||
import androidx.ui.test.performClick
|
import dev.msfjarvis.todo.data.model.TodoItem
|
||||||
import dev.msfjarvis.todo.ui.TodoTheme
|
import dev.msfjarvis.todo.ui.TodoTheme
|
||||||
import org.junit.Rule
|
import org.junit.Rule
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
@ -19,10 +17,15 @@ class MainActivityTest {
|
||||||
fun test_item_addition() {
|
fun test_item_addition() {
|
||||||
composeTestRule.setContent {
|
composeTestRule.setContent {
|
||||||
TodoTheme {
|
TodoTheme {
|
||||||
TodoApp()
|
val items = arrayListOf(TodoItem("Item 1"))
|
||||||
|
TodoApp(
|
||||||
|
items,
|
||||||
|
items::add,
|
||||||
|
items::remove,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onNode(hasTestTag("fab")).performClick()
|
//onNode(hasTestTag("fab")).performClick()
|
||||||
onNodeWithText("Item 1").assertIsDisplayed()
|
onNodeWithText("Item 1").assertIsDisplayed()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue