feat(push_notifications): issue-660, fix: issue-908

This commit is contained in:
misha
2026-10-14 08:16:20 +03:00
parent 98c175df44
commit dcd343e765
29 changed files with 2281 additions and 608 deletions

View File

@@ -17,6 +17,7 @@ import 'package:eatvio_app/features/feed/presentation/bloc/feed_cubit/feed_state
import 'package:eatvio_app/generated/l10n.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_keyboard_visibility/flutter_keyboard_visibility.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:go_router/go_router.dart';
@@ -60,6 +61,7 @@ void main() {
});
tearDown(() {
KeyboardVisibilityTesting.setVisibilityForTesting(false);
blogPostCreateCubit.close();
});
@@ -128,12 +130,16 @@ void main() {
);
});
testWidgets('does not add extra space above the title field', (tester) async {
testWidgets('does not add extra space above the title field', (
tester,
) async {
await tester.pumpWidget(createTestWidget());
await tester.pumpAndSettle();
final titleTop = tester.getTopLeft(find.text('Заголовок')).dy;
final scrollTop = tester.getTopLeft(find.byType(SingleChildScrollView)).dy;
final scrollTop = tester
.getTopLeft(find.byType(SingleChildScrollView))
.dy;
expect(titleTop - scrollTop, 16);
});
@@ -281,6 +287,44 @@ void main() {
expect(find.text('Создать'), findsOneWidget);
});
testWidgets(
'keeps create button above the editor toolbar when the keyboard is visible',
(tester) async {
await tester.pumpWidget(createTestWidget());
await tester.pumpAndSettle();
KeyboardVisibilityTesting.setVisibilityForTesting(true);
await tester.pump();
await tester.pump();
final createButton = find.byKey(
AppKeys.blogPostCreateScreenCreateButton,
);
final editorToolbar = find.byKey(
const ValueKey('blogPostCreateEditorToolbar'),
);
expect(createButton, findsOneWidget);
expect(editorToolbar, findsOneWidget);
final buttonRect = tester.getRect(createButton);
final toolbarRect = tester.getRect(editorToolbar);
expect(buttonRect.overlaps(toolbarRect), isFalse);
expect(buttonRect.top, greaterThanOrEqualTo(toolbarRect.bottom));
await tester.tap(createButton);
await tester.pumpAndSettle();
expect(
find.text(
'Добавьте заголовок, описание, изображение или ссылку на видео',
),
findsOneWidget,
);
},
);
testWidgets('does not submit when form is empty', (tester) async {
when(
() => mockBlogPostRepository.createBlogPost(