mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-11-26 22:31:18 +03:00
fix: close other tabs before switching workspace (#6830)
* fix: close other tabs before swtching workspace * test: close other tabs before switching workspace * chore: update release note * test: close other tabs before switching workspace
This commit is contained in:
parent
c24b68481d
commit
a0d8711d5c
12
CHANGELOG.md
12
CHANGELOG.md
@ -1,4 +1,16 @@
|
||||
# Release Notes
|
||||
# Release Notes
|
||||
## Version 0.7.4 - 19/11/2024
|
||||
### New Features
|
||||
- Support uploading WebP and BMP images
|
||||
- Support managing workspaces on mobile
|
||||
- Support adding toggle headings on mobile
|
||||
- Improve the AI chat page UI
|
||||
### Bug Fixes
|
||||
- Optimized the workspace menu loading performance
|
||||
- Optimized tab switching performance
|
||||
- Fixed searching issues in Document page
|
||||
|
||||
## Version 0.7.3 - 07/11/2024
|
||||
### New Features
|
||||
- Enable custom URLs for published pages
|
||||
|
@ -0,0 +1,75 @@
|
||||
import 'package:appflowy/env/cloud_env.dart';
|
||||
import 'package:appflowy/plugins/document/presentation/editor_plugins/openai/widgets/loading.dart';
|
||||
import 'package:appflowy/workspace/presentation/home/menu/sidebar/workspace/_sidebar_workspace_menu.dart';
|
||||
import 'package:appflowy/workspace/presentation/home/tabs/flowy_tab.dart';
|
||||
import 'package:appflowy/workspace/presentation/home/tabs/tabs_manager.dart';
|
||||
import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:integration_test/integration_test.dart';
|
||||
|
||||
import '../../../shared/constants.dart';
|
||||
import '../../../shared/util.dart';
|
||||
|
||||
void main() {
|
||||
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
group('Tabs', () {
|
||||
testWidgets('close other tabs before opening a new workspace',
|
||||
(tester) async {
|
||||
await tester.initializeAppFlowy(
|
||||
cloudType: AuthenticatorType.appflowyCloudSelfHost,
|
||||
);
|
||||
await tester.tapGoogleLoginInButton();
|
||||
await tester.expectToSeeHomePageWithGetStartedPage();
|
||||
|
||||
const name = 'AppFlowy.IO';
|
||||
// the workspace will be opened after created
|
||||
await tester.createCollaborativeWorkspace(name);
|
||||
|
||||
final loading = find.byType(Loading);
|
||||
await tester.pumpUntilNotFound(loading);
|
||||
|
||||
// create new tabs in the workspace
|
||||
expect(find.byType(FlowyTab), findsNothing);
|
||||
|
||||
const documentOneName = 'document one';
|
||||
const documentTwoName = 'document two';
|
||||
await tester.createNewPageInSpace(
|
||||
spaceName: Constants.generalSpaceName,
|
||||
layout: ViewLayoutPB.Document,
|
||||
pageName: documentOneName,
|
||||
);
|
||||
await tester.createNewPageInSpace(
|
||||
spaceName: Constants.generalSpaceName,
|
||||
layout: ViewLayoutPB.Document,
|
||||
pageName: documentTwoName,
|
||||
);
|
||||
|
||||
/// Open second menu item in a new tab
|
||||
await tester.openAppInNewTab(documentOneName, ViewLayoutPB.Document);
|
||||
|
||||
/// Open third menu item in a new tab
|
||||
await tester.openAppInNewTab(documentTwoName, ViewLayoutPB.Document);
|
||||
|
||||
expect(
|
||||
find.descendant(
|
||||
of: find.byType(TabsManager),
|
||||
matching: find.byType(FlowyTab),
|
||||
),
|
||||
findsNWidgets(2),
|
||||
);
|
||||
|
||||
// switch to the another workspace
|
||||
final Finder items = find.byType(WorkspaceMenuItem);
|
||||
await tester.openCollaborativeWorkspaceMenu();
|
||||
await tester.pumpUntilFound(items);
|
||||
expect(items, findsNWidgets(2));
|
||||
|
||||
// open the first workspace
|
||||
await tester.tap(items.first);
|
||||
await tester.pumpUntilNotFound(loading);
|
||||
|
||||
expect(find.byType(FlowyTab), findsNothing);
|
||||
});
|
||||
});
|
||||
}
|
@ -3,6 +3,7 @@ import 'package:integration_test/integration_test.dart';
|
||||
import 'change_name_and_icon_test.dart' as change_name_and_icon_test;
|
||||
import 'collaborative_workspace_test.dart' as collaborative_workspace_test;
|
||||
import 'share_menu_test.dart' as share_menu_test;
|
||||
import 'tabs_test.dart' as tabs_test;
|
||||
import 'workspace_icon_test.dart' as workspace_icon_test;
|
||||
import 'workspace_settings_test.dart' as workspace_settings_test;
|
||||
|
||||
@ -14,4 +15,5 @@ void main() {
|
||||
collaborative_workspace_test.main();
|
||||
change_name_and_icon_test.main();
|
||||
workspace_icon_test.main();
|
||||
tabs_test.main();
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ import 'package:appflowy/generated/flowy_svgs.g.dart';
|
||||
import 'package:appflowy/generated/locale_keys.g.dart';
|
||||
import 'package:appflowy/startup/startup.dart';
|
||||
import 'package:appflowy/user/application/auth/auth_service.dart';
|
||||
import 'package:appflowy/workspace/application/tabs/tabs_bloc.dart';
|
||||
import 'package:appflowy/workspace/application/user/user_workspace_bloc.dart';
|
||||
import 'package:appflowy/workspace/presentation/home/menu/sidebar/workspace/_sidebar_workspace_actions.dart';
|
||||
import 'package:appflowy/workspace/presentation/home/menu/sidebar/workspace/_sidebar_workspace_icon.dart';
|
||||
@ -297,12 +298,16 @@ class _WorkspaceInfo extends StatelessWidget {
|
||||
|
||||
void _openWorkspace(BuildContext context) {
|
||||
if (!isSelected) {
|
||||
// close the other tabs before opening another workspace.
|
||||
getIt<TabsBloc>().add(const TabsEvent.closeOtherTabs(''));
|
||||
|
||||
Log.info('open workspace: ${workspace.workspaceId}');
|
||||
context.read<UserWorkspaceBloc>().add(
|
||||
UserWorkspaceEvent.openWorkspace(
|
||||
workspace.workspaceId,
|
||||
),
|
||||
);
|
||||
|
||||
PopoverContainer.of(context).closeAll();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user