Skip to content

Commit 2315cd2

Browse files
committed
wip
Signed-off-by: Zixuan James Li <[email protected]>
1 parent 05a7975 commit 2315cd2

File tree

2 files changed

+29
-21
lines changed

2 files changed

+29
-21
lines changed

lib/model/typing_status.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class TypingStatus extends ChangeNotifier {
9191

9292
/// Manages updates to the user's typing status.
9393
///
94-
/// See the server implementation:
94+
/// See the web implementation:
9595
/// https://github.com/zulip/zulip/blob/52a9846cdf4abfbe937a94559690d508e95f4065/web/shared/src/typing_status.ts
9696
class TypingNotifier {
9797
TypingNotifier({

test/widgets/compose_box_test.dart

+28-20
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ void main() {
5555
return controllerKey;
5656
}
5757

58+
// TODO prepareComposeBoxWithNavigation
59+
5860
group('ComposeContentController', () {
5961
group('insertPadded', () {
6062
// Like `parseMarkedText` in test/model/autocomplete_test.dart,
@@ -198,16 +200,16 @@ void main() {
198200

199201
testWidgets('$narrow: unfocusing content input stops previous typing notification', (tester) async {
200202
// TODO
201-
// await prepareComposeBox(tester, narrow: narrow);
203+
await prepareComposeBox(tester, narrow: narrow);
202204

203-
// connection.prepare(json: {});
204-
// await tester.enterText(contentInputFinder, 'hello world');
205-
// checkTypingRequest(TypingOp.start, narrow);
205+
connection.prepare(json: {});
206+
await tester.enterText(contentInputFinder, 'hello world');
207+
checkTypingRequest(TypingOp.start, narrow);
206208

207-
// connection.prepare(json: {});
208-
// await tester.press(find.widgetWithIcon(IconButton, Icons.attach_file));
209-
// await tester.pump();
210-
// checkTypingRequest(TypingOp.stop, narrow);
209+
connection.prepare(json: {});
210+
await tester.tap(find.widgetWithIcon(IconButton, Icons.attach_file));
211+
await tester.pump();
212+
checkTypingRequest(TypingOp.stop, narrow);
211213
});
212214
}
213215

@@ -233,18 +235,24 @@ void main() {
233235

234236
testWidgets('unfocusing content input stops previous typing notification', (tester) async {
235237
// TODO
236-
// const narrow = ChannelNarrow(123);
237-
// await prepareComposeBox(tester, narrow: narrow);
238-
239-
// await tester.enterText(topicInputFinder, 'topic');
240-
// // Clean an irrelevant topic request.
241-
// check(connection.takePreviousRequests()).single
242-
// ..method.equals('GET')
243-
// ..url.path.equals('/api/v1/users/me/123/topics');
244-
245-
// connection.prepare(json: {});
246-
// await tester.enterText(contentInputFinder, 'hello world');
247-
// checkTypingRequest(TypingOp.start, TopicNarrow(narrow.streamId, 'topic'));
238+
const narrow = ChannelNarrow(123);
239+
await prepareComposeBox(tester, narrow: narrow);
240+
241+
await tester.enterText(topicInputFinder, 'topic');
242+
// Clean an irrelevant topic request.
243+
check(connection.takePreviousRequests()).single
244+
..method.equals('GET')
245+
..url.path.equals('/api/v1/users/me/123/topics');
246+
247+
connection.prepare(json: {});
248+
await tester.enterText(contentInputFinder, 'hello world');
249+
checkTypingRequest(TypingOp.start, TopicNarrow(narrow.streamId, 'topic'));
250+
251+
connection.prepare(json: {});
252+
// await tester.enterText(topicInputFinder, 'asd');
253+
await tester.tap(topicInputFinder);
254+
await tester.pump();
255+
checkTypingRequest(TypingOp.stop, TopicNarrow(narrow.streamId, 'topic'));
248256
});
249257
});
250258

0 commit comments

Comments
 (0)