diff --git a/frontend/app_flowy/packages/appflowy_editor/test/service/scroll_service_test.dart b/frontend/app_flowy/packages/appflowy_editor/test/service/scroll_service_test.dart new file mode 100644 index 0000000000..cf724a731c --- /dev/null +++ b/frontend/app_flowy/packages/appflowy_editor/test/service/scroll_service_test.dart @@ -0,0 +1,31 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import '../infra/test_editor.dart'; + +void main() async { + setUpAll(() { + TestWidgetsFlutterBinding.ensureInitialized(); + }); + + group('Testing Scroll With Gestures', () { + testWidgets('Test Gestsure Scroll', (tester) async { + final editor = tester.editor; + for (var i = 0; i < 100; i++) { + editor.insertTextNode('$i'); + } + editor.insertTextNode('mark'); + for (var i = 100; i < 200; i++) { + editor.insertTextNode('$i'); + } + await editor.startTesting(); + + final listFinder = find.byType(Scrollable); + final itemFinder = find.text('mark', findRichText: true); + + await tester.scrollUntilVisible(itemFinder, 500.0, + scrollable: listFinder); + + expect(itemFinder, findsOneWidget); + }); + }); +}