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:
Mathias Mogensen 2024-02-12 00:27:10 +01:00 • committed by GitHub
commit 66762ef9a0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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);