forked from AppFlowy-IO/AppFlowy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: icons not supported in callout(AppFlowy-IO#7192) (AppFlowy-IO#7197)
- Loading branch information
Showing
4 changed files
with
111 additions
and
17 deletions.
There are no files selected for viewing
67 changes: 67 additions & 0 deletions
67
frontend/appflowy_flutter/integration_test/desktop/document/document_callout_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import 'dart:convert'; | ||
|
||
import 'package:appflowy/generated/locale_keys.g.dart'; | ||
import 'package:appflowy/plugins/base/icon/icon_widget.dart'; | ||
import 'package:appflowy/plugins/document/presentation/editor_plugins/base/emoji_picker_button.dart'; | ||
import 'package:appflowy/plugins/document/presentation/editor_plugins/callout/callout_block_component.dart'; | ||
import 'package:appflowy/shared/icon_emoji_picker/icon_picker.dart'; | ||
import 'package:appflowy/shared/icon_emoji_picker/recent_icons.dart'; | ||
import 'package:easy_localization/easy_localization.dart'; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:integration_test/integration_test.dart'; | ||
|
||
import '../../shared/emoji.dart'; | ||
import '../../shared/util.dart'; | ||
|
||
void main() { | ||
setUpAll(() { | ||
IntegrationTestWidgetsFlutterBinding.ensureInitialized(); | ||
RecentIcons.enable = false; | ||
}); | ||
|
||
tearDownAll(() { | ||
RecentIcons.enable = true; | ||
}); | ||
|
||
testWidgets('callout with emoji icon picker', (tester) async { | ||
await tester.initializeAppFlowy(); | ||
await tester.tapAnonymousSignInButton(); | ||
final emojiIconData = await tester.loadIcon(); | ||
|
||
/// create a new document | ||
await tester.createNewPageWithNameUnderParent(); | ||
|
||
/// tap the first line of the document | ||
await tester.editor.tapLineOfEditorAt(0); | ||
|
||
/// create callout | ||
await tester.editor.showSlashMenu(); | ||
await tester.pumpAndSettle(); | ||
await tester.editor.tapSlashMenuItemWithName( | ||
LocaleKeys.document_slashMenu_name_callout.tr(), | ||
); | ||
|
||
/// select an icon | ||
final emojiPickerButton = find.descendant( | ||
of: find.byType(CalloutBlockComponentWidget), | ||
matching: find.byType(EmojiPickerButton), | ||
); | ||
await tester.tapButton(emojiPickerButton); | ||
await tester.tapIcon(emojiIconData); | ||
|
||
/// verification results | ||
final iconData = IconsData.fromJson(jsonDecode(emojiIconData.emoji)); | ||
final iconWidget = find | ||
.descendant( | ||
of: emojiPickerButton, | ||
matching: find.byType(IconWidget), | ||
) | ||
.evaluate() | ||
.first | ||
.widget as IconWidget; | ||
final iconWidgetData = iconWidget.data; | ||
expect(iconWidgetData.iconContent, iconData.iconContent); | ||
expect(iconWidgetData.iconName, iconData.iconName); | ||
expect(iconWidgetData.groupName, iconData.groupName); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters