chore: update l10n (#463)

This commit is contained in:
Sun Jiao 2023-09-15 16:13:49 +08:00 • committed by GitHub
commit 1944ab7a29
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 641 additions and 60 deletions

View file

@ -7,6 +7,9 @@ import 'package:network_image_mock/network_image_mock.dart';
void main() async {
/// customize the action builder
await AppFlowyEditorLocalizations.load(
const Locale.fromSubtags(languageCode: 'en'),
);
testWidgets('customize the image block\'s menu', (tester) async {
await mockNetworkImagesFor(() async {
const widget = CustomActionBuilder();

View file

@ -12,6 +12,9 @@ void main() async {
// 1. When the text field is focused, the editor's cursor should be disabled.
// 2. When the editor is focused, the text field's cursor should be disabled.
// 3. Tapping a non-first line of the editor should still allow the editor to grab focus.
await AppFlowyEditorLocalizations.load(
const Locale.fromSubtags(languageCode: 'en'),
);
testWidgets('text field + editor', (tester) async {
const widget = CustomAttributeKeyForTextBlock();
await tester.pumpWidget(widget);

View file

@ -10,6 +10,9 @@ void main() async {
/// - bulleted list
/// - todo list
/// - quote
await AppFlowyEditorLocalizations.load(
const Locale.fromSubtags(languageCode: 'en'),
);
testWidgets('custom block icon', (tester) async {
await mockNetworkImagesFor(() async {
const widget = CustomBlockIcon();

View file

@ -4,6 +4,9 @@ import 'package:flutter_test/flutter_test.dart';
import 'package:network_image_mock/network_image_mock.dart';
void main() async {
await AppFlowyEditorLocalizations.load(
const Locale.fromSubtags(languageCode: 'en'),
);
testWidgets('wrapp editor with directionality', (tester) async {
await mockNetworkImagesFor(() async {
const widget = DirectionalityTester();

View file

@ -7,6 +7,9 @@ import 'package:network_image_mock/network_image_mock.dart';
void main() async {
/// customize the image menu
await AppFlowyEditorLocalizations.load(
const Locale.fromSubtags(languageCode: 'en'),
);
testWidgets('customize the image block\'s menu', (tester) async {
await mockNetworkImagesFor(() async {
const widget = CustomImageMenu();

View file

@ -7,6 +7,9 @@ void main() async {
TestWidgetsFlutterBinding.ensureInitialized();
});
await AppFlowyEditorLocalizations.load(
const Locale.fromSubtags(languageCode: 'en'),
);
testWidgets('customize highlight color', (tester) async {
const text = 'Hello World';
final document = Document.blank()

View file

@ -10,6 +10,9 @@ void main() async {
// 1. When the text field is focused, the editor's cursor should be disabled.
// 2. When the editor is focused, the text field's cursor should be disabled.
// 3. Tapping a non-first line of the editor should still allow the editor to grab focus.
await AppFlowyEditorLocalizations.load(
const Locale.fromSubtags(languageCode: 'en'),
);
testWidgets('text field + editor', (tester) async {
final widget = TextFieldAndEditor();
await tester.pumpWidget(widget);

View file

@ -1,7 +1,11 @@
import 'dart:convert';
import 'package:appflowy_editor/appflowy_editor.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import '../../../new/util/util.dart';
import '../../../test_helper.dart';
void main() {
group('InsertImage', () {
@ -19,4 +23,49 @@ void main() {
expect(editorState.document.root.children.length, 2);
});
});
group('ImageWidget', () {
testWidgets('invalidURL', (tester) async {
await tester.buildAndPump(
UploadImageMenu(
onSubmitted: (String text) {},
onUpload: (String text) {},
),
);
final urlButtonFinder = find.widgetWithText(Tab, 'URL Image');
expect(urlButtonFinder, findsOneWidget);
await tester.tap(urlButtonFinder);
await tester.pumpAndSettle();
final urlFieldFinder = find.widgetWithText(TextField, 'URL');
expect(urlFieldFinder, findsOneWidget);
await tester.enterText(urlFieldFinder, 'Hello World!');
final uploadButtonFinder = find.text('Upload');
expect(uploadButtonFinder, findsOneWidget);
await tester.tap(uploadButtonFinder);
await tester.pumpAndSettle();
final incorrectLinkFinder = find.text('Incorrect Link');
expect(incorrectLinkFinder, findsOneWidget);
});
testWidgets('imageLoadError', (tester) async {
await AppFlowyEditorLocalizations.load(
const Locale.fromSubtags(languageCode: 'en'),
);
await tester.buildAndPump(
AppFlowyEditor(
editorState: EditorState(
document: Document.fromJson(
json.decode(
'{"document":{"type":"page","children":[{"type":"heading","data":{"level":2,"delta":[]}},{"type":"image","data":{"url":"https://127.0.0.1/image/not/exist.jpg","align":"center"}}]}}',
),
),
),
),
);
final couldNotLoadFinder = find.text('Could not load the image');
expect(couldNotLoadFinder, findsOneWidget);
});
});
}

View file

@ -114,7 +114,7 @@ void main() {
"insert": "inline code",
"attributes": {
"bg_color": "0x26878378",
"font_color": "0xffeb5757"
"font_color": "0xffeb5757",
},
},
{"insert": "."},