mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix: add simple test for l10n
This commit is contained in:
parent
68997a9c93
commit
8137769edd
frontend/app_flowy/packages/appflowy_editor
@ -29,6 +29,9 @@ dev_dependencies:
|
||||
sdk: flutter
|
||||
flutter_lints: ^2.0.1
|
||||
network_image_mock: ^2.1.1
|
||||
flutter_localizations:
|
||||
sdk: flutter
|
||||
|
||||
|
||||
# For information on the generic Dart part of this file, see the
|
||||
# following page: https://dart.dev/tools/pub/pubspec
|
||||
|
@ -3,6 +3,7 @@ import 'dart:collection';
|
||||
import 'package:appflowy_editor/appflowy_editor.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import 'test_raw_key_event.dart';
|
||||
@ -22,12 +23,18 @@ class EditorWidgetTester {
|
||||
Selection? get documentSelection =>
|
||||
_editorState.service.selectionService.currentSelection.value;
|
||||
|
||||
Future<EditorWidgetTester> startTesting() async {
|
||||
Future<EditorWidgetTester> startTesting({
|
||||
Locale locale = const Locale('en'),
|
||||
}) async {
|
||||
final app = MaterialApp(
|
||||
localizationsDelegates: const [
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalCupertinoLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
AppFlowyEditorLocalizations.delegate,
|
||||
],
|
||||
supportedLocales: AppFlowyEditorLocalizations.delegate.supportedLocales,
|
||||
locale: locale,
|
||||
home: Scaffold(
|
||||
body: AppFlowyEditor(
|
||||
editorState: _editorState,
|
||||
|
@ -0,0 +1,19 @@
|
||||
import 'package:appflowy_editor/appflowy_editor.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import '../infra/test_editor.dart';
|
||||
|
||||
void main() async {
|
||||
setUpAll(() {
|
||||
TestWidgetsFlutterBinding.ensureInitialized();
|
||||
});
|
||||
|
||||
group('l10n.dart', () {
|
||||
for (final locale
|
||||
in AppFlowyEditorLocalizations.delegate.supportedLocales) {
|
||||
testWidgets('test localization', (tester) async {
|
||||
final editor = tester.editor..insertTextNode('');
|
||||
await editor.startTesting(locale: locale);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user