@@ -51,6 +51,11 @@ void main() {
51
51
await tester.pumpAndSettle ();
52
52
}
53
53
54
+ List <StreamMessage > generateStreamMessages (ZulipStream stream, int count) {
55
+ return List .generate (count, (index) => eg.streamMessage (
56
+ stream: stream, topic: '${stream .name } topic $index ' , flags: []));
57
+ }
58
+
54
59
/// Set up an inbox view with lots of interesting content.
55
60
Future <void > setupVarious (WidgetTester tester) async {
56
61
final stream1 = eg.stream (streamId: 1 , name: 'stream 1' );
@@ -64,7 +69,9 @@ void main() {
64
69
users: [eg.selfUser, eg.otherUser, eg.thirdUser],
65
70
unreadMessages: [
66
71
eg.streamMessage (stream: stream1, topic: 'specific topic' , flags: []),
72
+ ...generateStreamMessages (stream1, 10 ),
67
73
eg.streamMessage (stream: stream2, flags: []),
74
+ ...generateStreamMessages (stream2, 40 ),
68
75
eg.dmMessage (from: eg.otherUser, to: [eg.selfUser], flags: []),
69
76
eg.dmMessage (from: eg.otherUser, to: [eg.selfUser, eg.thirdUser], flags: []),
70
77
]);
@@ -310,6 +317,30 @@ void main() {
310
317
checkAppearsUncollapsed (tester, findSectionContent);
311
318
});
312
319
320
+ testWidgets ('collapse all-DMs section after scroll' , (tester) async {
321
+ await setupVarious (tester);
322
+
323
+ final listFinder = find.byType (Scrollable );
324
+ // Scroll the [StickyHeaderListView] enough so that
325
+ // the [_AllDmsSection] shows a sticky header
326
+ await tester.drag (listFinder, const Offset (0 , - 50 ));
327
+
328
+ final headerRow = findAllDmsHeaderRow (tester);
329
+ // Check that the sticky header is present
330
+ check (headerRow).isNotNull ();
331
+
332
+ final findSectionContent = find.text (eg.otherUser.fullName);
333
+
334
+ checkAppearsUncollapsed (tester, findSectionContent);
335
+ await tapCollapseIcon (tester);
336
+ // Check that the header is still visible even after
337
+ // collapsing the section
338
+ check (headerRow).isNotNull ();
339
+ checkAppearsCollapsed (tester, findSectionContent);
340
+ await tapCollapseIcon (tester);
341
+ checkAppearsUncollapsed (tester, findSectionContent);
342
+ });
343
+
313
344
// TODO check it remains collapsed even if you scroll far away and back
314
345
315
346
// TODO check that it's always uncollapsed when it appears after being
@@ -385,6 +416,30 @@ void main() {
385
416
checkAppearsUncollapsed (tester, 1 , findSectionContent);
386
417
});
387
418
419
+ testWidgets ('collapse stream section after scroll' , (tester) async {
420
+ await setupVarious (tester);
421
+
422
+ final listFinder = find.byType (Scrollable );
423
+ // Scroll the [StickyHeaderListView] enough so that
424
+ // the [_StreamSection] shows a sticky header
425
+ await tester.drag (listFinder, const Offset (0 , - 200 ));
426
+
427
+ final headerRow = findStreamHeaderRow (tester, 1 );
428
+ // Check that the sticky header is present
429
+ check (headerRow).isNotNull ();
430
+
431
+ final findSectionContent = find.text ('specific topic' );
432
+
433
+ checkAppearsUncollapsed (tester, 1 , findSectionContent);
434
+ await tapCollapseIcon (tester, 1 );
435
+ // Check that the header is still visible even after
436
+ // collapsing the section
437
+ check (headerRow).isNotNull ();
438
+ checkAppearsCollapsed (tester, 1 , findSectionContent);
439
+ await tapCollapseIcon (tester, 1 );
440
+ checkAppearsUncollapsed (tester, 1 , findSectionContent);
441
+ });
442
+
388
443
// TODO check it remains collapsed even if you scroll far away and back
389
444
390
445
// TODO check that it's always uncollapsed when it appears after being
0 commit comments