Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
Signed-off-by: Zixuan James Li <[email protected]>
  • Loading branch information
PIG208 committed Aug 20, 2024
1 parent 05a7975 commit 2315cd2
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 21 deletions.
2 changes: 1 addition & 1 deletion lib/model/typing_status.dart
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class TypingStatus extends ChangeNotifier {

/// Manages updates to the user's typing status.
///
/// See the server implementation:
/// See the web implementation:
/// https://github.com/zulip/zulip/blob/52a9846cdf4abfbe937a94559690d508e95f4065/web/shared/src/typing_status.ts
class TypingNotifier {
TypingNotifier({
Expand Down
48 changes: 28 additions & 20 deletions test/widgets/compose_box_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ void main() {
return controllerKey;
}

// TODO prepareComposeBoxWithNavigation

group('ComposeContentController', () {
group('insertPadded', () {
// Like `parseMarkedText` in test/model/autocomplete_test.dart,
Expand Down Expand Up @@ -198,16 +200,16 @@ void main() {

testWidgets('$narrow: unfocusing content input stops previous typing notification', (tester) async {
// TODO
// await prepareComposeBox(tester, narrow: narrow);
await prepareComposeBox(tester, narrow: narrow);

// connection.prepare(json: {});
// await tester.enterText(contentInputFinder, 'hello world');
// checkTypingRequest(TypingOp.start, narrow);
connection.prepare(json: {});
await tester.enterText(contentInputFinder, 'hello world');
checkTypingRequest(TypingOp.start, narrow);

// connection.prepare(json: {});
// await tester.press(find.widgetWithIcon(IconButton, Icons.attach_file));
// await tester.pump();
// checkTypingRequest(TypingOp.stop, narrow);
connection.prepare(json: {});
await tester.tap(find.widgetWithIcon(IconButton, Icons.attach_file));
await tester.pump();
checkTypingRequest(TypingOp.stop, narrow);
});
}

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

testWidgets('unfocusing content input stops previous typing notification', (tester) async {
// TODO
// const narrow = ChannelNarrow(123);
// await prepareComposeBox(tester, narrow: narrow);

// await tester.enterText(topicInputFinder, 'topic');
// // Clean an irrelevant topic request.
// check(connection.takePreviousRequests()).single
// ..method.equals('GET')
// ..url.path.equals('/api/v1/users/me/123/topics');

// connection.prepare(json: {});
// await tester.enterText(contentInputFinder, 'hello world');
// checkTypingRequest(TypingOp.start, TopicNarrow(narrow.streamId, 'topic'));
const narrow = ChannelNarrow(123);
await prepareComposeBox(tester, narrow: narrow);

await tester.enterText(topicInputFinder, 'topic');
// Clean an irrelevant topic request.
check(connection.takePreviousRequests()).single
..method.equals('GET')
..url.path.equals('/api/v1/users/me/123/topics');

connection.prepare(json: {});
await tester.enterText(contentInputFinder, 'hello world');
checkTypingRequest(TypingOp.start, TopicNarrow(narrow.streamId, 'topic'));

connection.prepare(json: {});
// await tester.enterText(topicInputFinder, 'asd');
await tester.tap(topicInputFinder);
await tester.pump();
checkTypingRequest(TypingOp.stop, TopicNarrow(narrow.streamId, 'topic'));
});
});

Expand Down

0 comments on commit 2315cd2

Please sign in to comment.