feat: debounce on word count service (#711)
* feat: debounce on word count service * test: add pump for debounce in test
This commit is contained in:
parent
e09bde476b
commit
66762ef9a0
1 changed files with 62 additions and 15 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import 'package:appflowy_editor/appflowy_editor.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import 'package:appflowy_editor/appflowy_editor.dart';
|
||||
|
||||
import '../../new/infra/testable_editor.dart';
|
||||
|
||||
void main() async {
|
||||
|
|
@ -44,7 +45,7 @@ void main() async {
|
|||
|
||||
await editor.editorState.apply(transaction);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
await tester.pumpAndSettle(const Duration(milliseconds: 300));
|
||||
|
||||
expect(service.documentCounters.wordCount, 3 * 4);
|
||||
expect(service.documentCounters.charCount, text.length * 4);
|
||||
|
|
@ -53,6 +54,8 @@ void main() async {
|
|||
|
||||
service.stop();
|
||||
|
||||
await tester.pumpAndSettle(const Duration(milliseconds: 300));
|
||||
|
||||
expect(service.documentCounters.wordCount, 0);
|
||||
expect(service.documentCounters.charCount, 0);
|
||||
expect(wordCount, 0);
|
||||
|
|
|
|||
Loading…
Reference in a new issue