File tree 2 files changed +14
-0
lines changed 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,9 @@ import 'theme.dart';
29
29
///
30
30
/// To obtain one of these, see [MessageListPage.ancestorOf] .
31
31
abstract class MessageListPageState {
32
+ /// The narrow for this page's message list.
33
+ Narrow get narrow;
34
+
32
35
/// The controller for this [MessageListPage] 's compose box,
33
36
/// if this [MessageListPage] offers a compose box.
34
37
ComposeBoxController ? get composeBoxController;
@@ -65,6 +68,9 @@ class MessageListPage extends StatefulWidget {
65
68
const _kUnsubscribedStreamRecipientHeaderColor = Color (0xfff5f5f5 );
66
69
67
70
class _MessageListPageState extends State <MessageListPage > implements MessageListPageState {
71
+ @override
72
+ Narrow get narrow => widget.narrow;
73
+
68
74
@override
69
75
ComposeBoxController ? get composeBoxController => _composeBoxKey.currentState;
70
76
Original file line number Diff line number Diff line change @@ -105,6 +105,14 @@ void main() {
105
105
.throws <void >();
106
106
});
107
107
108
+ testWidgets ('MessageListPageState.narrow' , (tester) async {
109
+ final stream = eg.stream ();
110
+ await setupMessageListPage (tester, narrow: StreamNarrow (stream.streamId),
111
+ messages: [eg.streamMessage (stream: stream, content: "<p>a message</p>" )]);
112
+ final state = MessageListPage .ancestorOf (tester.element (find.text ("a message" )));
113
+ check (state.narrow).equals (StreamNarrow (stream.streamId));
114
+ });
115
+
108
116
testWidgets ('composeBoxController finds compose box' , (tester) async {
109
117
final stream = eg.stream ();
110
118
await setupMessageListPage (tester, narrow: StreamNarrow (stream.streamId),
You can’t perform that action at this time.
0 commit comments