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