feat(flutter): 播放页互动数量与评论面板收紧

This commit is contained in:
Zhou Weidong committed 2026-10-20 12:06:21 +08:00
1 parent e39aa766ac
commit bed6bbb75b
13 files changed
+265 -59

No files matched your search

@@ -106,9 +106,57 @@ void main() {
find.byKey(const Key('comment-input')),
);
expect(field.controller?.text, 'blocked text');
// 发送失败时保留输入与焦点,用户可以直接改完再发。
expect(field.focusNode?.hasFocus, isTrue);
},
);
testWidgets('should_unfocus_input_after_successful_post', (tester) async {
final repository = FakeCommentRepository(
pages: [const CommentPage()],
publishResult: commentFixture(id: '11', content: 'Nice demo', mine: true),
);
await _pumpSheet(tester, repository: repository);
final input = find.byKey(const Key('comment-input'));
await tester.tap(input);
await tester.pump();
expect(tester.widget<TextField>(input).focusNode?.hasFocus, isTrue);
await tester.enterText(input, 'Nice demo');
await tester.tap(find.byKey(const Key('comment-post')));
await tester.pumpAndSettle();
expect(tester.widget<TextField>(input).focusNode?.hasFocus, isFalse);
});
testWidgets('should_use_compact_comment_sizes', (tester) async {
final repository = FakeCommentRepository(
pages: [
CommentPage(
comments: [commentFixture(id: '10', content: 'Great episode')],
),
],
);
await _pumpSheet(tester, repository: repository);
expect(
tester.getSize(find.byKey(const Key('comment-post'))),
const Size(32, 32),
);
expect(tester.getSize(find.byKey(const Key('comment-input'))).height, 40);
final avatar = tester.widget<CircleAvatar>(
find.descendant(
of: find.byKey(const Key('comment-item-10')),
matching: find.byType(CircleAvatar),
),
);
expect(avatar.radius, 14);
final body = tester.widget<Text>(find.text('Great episode'));
expect(body.style?.fontSize, 13);
expect(body.style?.height, 1.2);
});
testWidgets('should_show_review_badge_and_server_replaced_content', (
tester,
) async {