Skip to content

Commit

Permalink
fix: unit testing error
Browse files Browse the repository at this point in the history
  • Loading branch information
asjqkkkk committed Dec 27, 2024
1 parent c5ac948 commit 1069482
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:appflowy/plugins/database/calendar/presentation/calendar_event_editor.dart';
import 'package:appflowy/shared/icon_emoji_picker/recent_icons.dart';
import 'package:appflowy_backend/protobuf/flowy-database2/protobuf.dart';
import 'package:appflowy_backend/protobuf/flowy-folder/view.pbenum.dart';
import 'package:flowy_infra_ui/style_widget/icon_button.dart';
Expand All @@ -9,7 +10,14 @@ import '../../shared/database_test_op.dart';
import '../../shared/util.dart';

void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
setUpAll(() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
RecentIcons.enable = false;
});

tearDownAll(() {
RecentIcons.enable = true;
});

group('calendar', () {
testWidgets('update calendar layout', (tester) async {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
import 'package:flutter/material.dart';

import 'package:appflowy/generated/locale_keys.g.dart';
import 'package:appflowy/plugins/database/grid/presentation/grid_page.dart';
import 'package:appflowy/plugins/database/widgets/field/type_option_editor/select/select_option.dart';
import 'package:appflowy/shared/icon_emoji_picker/recent_icons.dart';
import 'package:appflowy/util/field_type_extension.dart';
import 'package:appflowy_backend/protobuf/flowy-database2/protobuf.dart';
import 'package:appflowy_backend/protobuf/flowy-folder/protobuf.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';

import '../../shared/database_test_op.dart';
import '../../shared/util.dart';

void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
setUpAll(() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
RecentIcons.enable = false;
});

tearDownAll(() {
RecentIcons.enable = true;
});

group('grid edit field test:', () {
testWidgets('rename existing field', (tester) async {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:appflowy/generated/locale_keys.g.dart';
import 'package:appflowy/plugins/base/emoji/emoji_picker.dart';
import 'package:appflowy/shared/icon_emoji_picker/flowy_icon_emoji_picker.dart';
import 'package:appflowy/shared/icon_emoji_picker/recent_icons.dart';
import 'package:appflowy/workspace/presentation/home/menu/view/view_item.dart';
import 'package:appflowy_backend/protobuf/flowy-folder/protobuf.dart';
import 'package:easy_localization/easy_localization.dart';
Expand All @@ -12,7 +13,14 @@ import '../../shared/emoji.dart';
import '../../shared/util.dart';

void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
setUpAll(() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
RecentIcons.enable = false;
});

tearDownAll(() {
RecentIcons.enable = true;
});

group('Sidebar view item tests', () {
testWidgets('Access view item context menu by right click', (tester) async {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,14 @@ class _FlowyEmojiSearchBarState extends State<FlowyEmojiSearchBar> {
onRandomEmojiSelected: widget.onRandomEmojiSelected,
),
const HSpace(8.0),
FlowyEmojiSkinToneSelector(onEmojiSkinToneChanged: (v) {
setState(() {
skinTone = v;
});
widget.onSkinToneChanged.call(v);
}),
FlowyEmojiSkinToneSelector(
onEmojiSkinToneChanged: (v) {
setState(() {
skinTone = v;
});
widget.onSkinToneChanged.call(v);
},
),
],
),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -771,13 +771,12 @@ class _SingleInnerViewItemState extends State<SingleInnerViewItem> {
context.read<ViewBloc>().add(const ViewEvent.collapseAllPages());
break;
case ViewMoreActionType.changeIcon:
if (data is! EmojiIconData) {
if (data is! SelectedEmojiIconResult) {
return;
}
final result = data;
await ViewBackendService.updateViewIcon(
viewId: widget.view.id,
viewIcon: result,
viewIcon: data.data,
);
break;
case ViewMoreActionType.moveTo:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ class ViewMoreActionPopover extends StatelessWidget {
(e) => ViewMoreActionTypeWrapper(e, view, (controller, data) {
onEditing(false);
onAction(e, data);
controller.close();
bool enableClose = true;
if (data is SelectedEmojiIconResult) {
if (data.keepOpen) enableClose = false;
}
if (enableClose) controller.close();
}),
)
.toList();
Expand Down

0 comments on commit 1069482

Please sign in to comment.