TestLithoView
Holder class for the result of LithoTestRule.render call, exposing methods to for finding the views/components and assertions
@RunWith(AndroidJUnit4::class)
class LithoSampleTest {
@Rule @JvmField val lithoViewRule = LithoTestRule()
@Test
fun test() {
val testLithoView = lithoViewRule.render { TestComponent() }
LithoAssertions.assertThat(testLithoView)
.willRenderContent()
.containsComponents(AnotherTestComponent::class)
.containsContentDescription(R.string.content_descr)
lithoViewRule.act(testLithoView) { clickOnTag("test_tag") }
LithoAssertions.assertThat(testLithoView)
.containsComponents(NewTestComponent::class)
}
}
Types
Properties
Functions
Explicitly attaches current root LithoView
Explicitly detaches current root LithoView
Returns a list of all components of the given classes from the ComponentTree or an empty list if not found
Returns the first LazyCollection from the ComponentTree, or null if not found.
Returns a component of the given class from the ComponentTree or null if not found
Returns a component of the given class only if it is a direct child of the root component
Finds the first View with the specified content description in the rendered hierarchy, throwing if it doesn't exist.
Finds the first View with the specified content description in the rendered hierarchy, returning null if is doesn't exist.
Finds the first View with the specified tag in the rendered hierarchy, throwing if it doesn't exist.
Finds the first View with the specified tag in the rendered hierarchy, returning null if is doesn't exist.
Finds the first View with the specified text in the rendered hierarchy, throwing if it doesn't exist.
Finds the first View with the specified text in the rendered hierarchy, returning null if is doesn't exist.
Explicitly calls layout on the current root LithoView. If there are any async events triggered by layout use together with idle
Explicitly calls measure on the current root LithoView
Explicitly releases current root LithoView
Sets the new root Component.Builder to render.
Sets the new root Component to render.
Sets the new root Component with new size spec to render.
Sets the new root Component.Builder to render asynchronously.
Sets the new root Component to render asynchronously.
Sets a new width and height which should be used to render.
Sets a new width spec and height spec which should be used to render.
Sets a new ComponentTree which should be used to render.
Sets a new LithoView which should be used to render.