History

Add documentation to the new test

Mikayla committed 2 years ago

Commit 80852c31 parent a99ee5e1 file · +10 −0Browse files

Unified · Split

crates/gpui/src/elements/list.rs+10−0
@@ -598,20 +598,30 @@ mod test { · 597 unmodified lines
598598 div().h(px(10.)).w_full().into_any()
599599 });
600600
601+ // Ensure that the list is scrolled to the top
602+ state.scroll_to(gpui::ListOffset {
603+ item_ix: 0,
604+ offset_in_item: px(0.0),
605+ });
606+
607+ // Paint
601608 cx.draw(
602609 point(px(0.), px(0.)),
603610 size(px(100.), px(20.)).into(),
604611 |_| list(state.clone()).w_full().h_full().z_index(10).into_any(),
605612 );
606613
614+ // Reset
607615 state.reset(5);
608616
617+ // And then recieve a scroll event _before_ the next paint
609618 cx.simulate_event(ScrollWheelEvent {
610619 position: point(px(1.), px(1.)),
611620 delta: ScrollDelta::Pixels(point(px(0.), px(-500.))),
612621 ..Default::default()
613622 });
614623
624+ // Scroll position should stay at the top of the list
615625 assert_eq!(state.logical_scroll_top().item_ix, 0);
616626 assert_eq!(state.logical_scroll_top().offset_in_item, px(0.));
617627