Skip to content

Commit

Permalink
Test WidgetValue correct when LazyColumn is populated (#1477)
Browse files Browse the repository at this point in the history
  • Loading branch information
veyndan authored Sep 13, 2023
1 parent 597c1dd commit 633c4b6
Showing 1 changed file with 35 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,39 @@ class LazyListTest {
),
)
}

@Test
fun populatedLazyColumn() = runTest {
val snapshot = TestSchemaTester {
setContent {
LazyColumn(
state = rememberLazyListState(),
placeholder = { Text("Placeholder") },
) {
items(10) {
Text(it.toString())
}
}
}
awaitSnapshot()
}

assertThat(snapshot)
.containsExactly(
LazyListValue(
Modifier,
isVertical = true,
onViewportChanged = { _, _ -> },
itemsBefore = 0,
itemsAfter = 0,
width = Constraint.Wrap,
height = Constraint.Wrap,
margin = Margin(0.0.dp),
crossAxisAlignment = CrossAxisAlignment.Start,
scrollItemIndex = ScrollItemIndex(0, 0),
placeholder = List(20) { TextValue(Modifier, "Placeholder") },
items = List(10) { TextValue(Modifier, it.toString()) },
),
)
}
}

0 comments on commit 633c4b6

Please sign in to comment.