mirror of
				https://github.com/AppFlowy-IO/AppFlowy.git
				synced 2025-10-31 18:15:09 +00:00 
			
		
		
		
	 c4fc60612f
			
		
	
	
		c4fc60612f
		
			
		
	
	
	
	
		
			
			* feat: implement backend logic * fix: did_create_row not working properly * fix: did_delete_group not working properly * fix: test * chore: fix clippy * fix: new card not editable and in wrong position * feat: imlement UI for add new stack * test: add integration test * chore: i18n * chore: remove debug message * chore: merge conflict --------- Co-authored-by: nathan <nathan@appflowy.io>
		
			
				
	
	
		
			105 lines
		
	
	
		
			3.5 KiB
		
	
	
	
		
			Dart
		
	
	
	
	
	
			
		
		
	
	
			105 lines
		
	
	
		
			3.5 KiB
		
	
	
	
		
			Dart
		
	
	
	
	
	
| import 'package:appflowy/generated/locale_keys.g.dart';
 | |
| import 'package:appflowy/plugins/database_view/widgets/card/card.dart';
 | |
| import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart';
 | |
| import 'package:appflowy_board/appflowy_board.dart';
 | |
| import 'package:easy_localization/easy_localization.dart';
 | |
| import 'package:flutter/services.dart';
 | |
| import 'package:flutter_test/flutter_test.dart';
 | |
| import 'package:integration_test/integration_test.dart';
 | |
| 
 | |
| import '../util/util.dart';
 | |
| import '../util/database_test_op.dart';
 | |
| 
 | |
| void main() {
 | |
|   IntegrationTestWidgetsFlutterBinding.ensureInitialized();
 | |
| 
 | |
|   group('board row test', () {
 | |
|     testWidgets('delete item in ToDo card', (tester) async {
 | |
|       await tester.initializeAppFlowy();
 | |
|       await tester.tapGoButton();
 | |
| 
 | |
|       await tester.createNewPageWithName(layout: ViewLayoutPB.Board);
 | |
|       const name = 'Card 1';
 | |
|       final card1 = find.findTextInFlowyText(name);
 | |
|       await tester.hoverOnWidget(
 | |
|         card1,
 | |
|         onHover: () async {
 | |
|           final moreOption = find.byType(CardMoreOption);
 | |
|           await tester.tapButton(moreOption);
 | |
|         },
 | |
|       );
 | |
|       await tester.tapButtonWithName(LocaleKeys.button_delete.tr());
 | |
|       expect(find.findTextInFlowyText(name), findsNothing);
 | |
|     });
 | |
| 
 | |
|     testWidgets('duplicate item in ToDo card', (tester) async {
 | |
|       await tester.initializeAppFlowy();
 | |
|       await tester.tapGoButton();
 | |
| 
 | |
|       await tester.createNewPageWithName(layout: ViewLayoutPB.Board);
 | |
|       const name = 'Card 1';
 | |
|       final card1 = find.findTextInFlowyText(name);
 | |
|       await tester.hoverOnWidget(
 | |
|         card1,
 | |
|         onHover: () async {
 | |
|           final moreOption = find.byType(CardMoreOption);
 | |
|           await tester.tapButton(moreOption);
 | |
|         },
 | |
|       );
 | |
|       await tester.tapButtonWithName(LocaleKeys.button_duplicate.tr());
 | |
|       expect(find.textContaining(name, findRichText: true), findsNWidgets(2));
 | |
|     });
 | |
| 
 | |
|     testWidgets('add new group', (tester) async {
 | |
|       await tester.initializeAppFlowy();
 | |
|       await tester.tapGoButton();
 | |
|       await tester.createNewPageWithName(layout: ViewLayoutPB.Board);
 | |
| 
 | |
|       // assert number of groups
 | |
|       tester.assertNumberOfGroups(4);
 | |
| 
 | |
|       // scroll the board horizontally to ensure add new group button appears
 | |
|       await tester.scrollBoardToEnd();
 | |
| 
 | |
|       // assert and click on add new group button
 | |
|       tester.assertNewGroupTextField(false);
 | |
|       await tester.tapNewGroupButton();
 | |
|       tester.assertNewGroupTextField(true);
 | |
| 
 | |
|       // enter new group name and submit
 | |
|       await tester.enterNewGroupName('needs design', submit: true);
 | |
| 
 | |
|       // assert number of groups has increased
 | |
|       tester.assertNumberOfGroups(5);
 | |
| 
 | |
|       // assert text field has disappeared
 | |
|       await tester.scrollBoardToEnd();
 | |
|       tester.assertNewGroupTextField(false);
 | |
| 
 | |
|       // click on add new group button
 | |
|       await tester.tapNewGroupButton();
 | |
|       tester.assertNewGroupTextField(true);
 | |
| 
 | |
|       // type some things
 | |
|       await tester.enterNewGroupName('needs planning', submit: false);
 | |
| 
 | |
|       // click on clear button and assert empty contents
 | |
|       await tester.clearNewGroupTextField();
 | |
| 
 | |
|       // press escape to cancel
 | |
|       await tester.sendKeyEvent(LogicalKeyboardKey.escape);
 | |
|       await tester.pumpAndSettle();
 | |
|       tester.assertNewGroupTextField(false);
 | |
| 
 | |
|       // click on add new group button
 | |
|       await tester.tapNewGroupButton();
 | |
|       tester.assertNewGroupTextField(true);
 | |
| 
 | |
|       // press elsewhere to cancel
 | |
|       await tester.tap(find.byType(AppFlowyBoard));
 | |
|       await tester.pumpAndSettle();
 | |
|       tester.assertNewGroupTextField(false);
 | |
|     });
 | |
|   });
 | |
| }
 |