diff --git a/frontend/appflowy_flutter/integration_test/desktop/database/database_row_page_test.dart b/frontend/appflowy_flutter/integration_test/desktop/database/database_row_page_test.dart index 8874cefb1c..22f059d199 100644 --- a/frontend/appflowy_flutter/integration_test/desktop/database/database_row_page_test.dart +++ b/frontend/appflowy_flutter/integration_test/desktop/database/database_row_page_test.dart @@ -394,11 +394,16 @@ void main() { isChecked: false, ); tester.assertPhantomChecklistItemAtIndex(index: 1); + tester.assertPhantomChecklistItemContent(""); await tester.enterText(find.byType(PhantomChecklistItem), 'task 2'); await tester.pumpAndSettle(); - await tester.simulateKeyEvent(LogicalKeyboardKey.enter); - await tester.pumpAndSettle(const Duration(milliseconds: 500)); + await tester.hoverOnWidget( + find.byType(ChecklistRowDetailCell), + onHover: () async { + await tester.tapButton(find.byType(ChecklistItemControl)); + }, + ); tester.assertChecklistTaskInEditor( index: 1, @@ -406,6 +411,7 @@ void main() { isChecked: false, ); tester.assertPhantomChecklistItemAtIndex(index: 2); + tester.assertPhantomChecklistItemContent(""); await tester.simulateKeyEvent(LogicalKeyboardKey.escape); await tester.pumpAndSettle(); diff --git a/frontend/appflowy_flutter/integration_test/shared/database_test_op.dart b/frontend/appflowy_flutter/integration_test/shared/database_test_op.dart index ff7e33ebdf..676c96f042 100644 --- a/frontend/appflowy_flutter/integration_test/shared/database_test_op.dart +++ b/frontend/appflowy_flutter/integration_test/shared/database_test_op.dart @@ -567,6 +567,12 @@ extension AppFlowyDatabaseTest on WidgetTester { expect(phantom is PhantomChecklistItem, true); } + void assertPhantomChecklistItemContent(String content) { + final phantom = find.byType(PhantomChecklistItem); + final text = find.text(content); + expect(find.descendant(of: phantom, matching: text), findsOneWidget); + } + Future openFirstRowDetailPage() async { await hoverOnFirstRowOfGrid(); diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/desktop_row_detail/desktop_row_detail_checklist_cell.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/desktop_row_detail/desktop_row_detail_checklist_cell.dart index d100a56860..d7e1d64fc3 100644 --- a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/desktop_row_detail/desktop_row_detail_checklist_cell.dart +++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/desktop_row_detail/desktop_row_detail_checklist_cell.dart @@ -89,7 +89,6 @@ class _ChecklistRowDetailCellState extends State { onTap: () { final bloc = context.read(); if (bloc.state.phantomIndex == null) { - phantomTextController.clear(); bloc.add( ChecklistCellEvent.updatePhantomIndex( bloc.state.showIncompleteOnly @@ -107,6 +106,7 @@ class _ChecklistRowDetailCellState extends State { ), ); } + phantomTextController.clear(); }, ), ],