mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
feat: immersive page style on mobile (#5135)
This commit is contained in:
@ -36,7 +36,7 @@ void main() {
|
||||
AppTheme.fallback,
|
||||
),
|
||||
verify: (bloc) {
|
||||
expect(bloc.state.font, builtInFontFamily);
|
||||
expect(bloc.state.font, builtInFontFamily());
|
||||
expect(bloc.state.monospaceFont, 'SF Mono');
|
||||
expect(bloc.state.themeMode, ThemeMode.system);
|
||||
},
|
||||
|
@ -1,8 +1,7 @@
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
import 'package:appflowy/core/config/kv_keys.dart';
|
||||
import 'package:appflowy/plugins/document/application/document_appearance_cubit.dart';
|
||||
import 'package:appflowy/workspace/application/settings/appearance/base_appearance.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
@ -28,7 +27,7 @@ void main() {
|
||||
|
||||
test('Initial state', () {
|
||||
expect(cubit.state.fontSize, 16.0);
|
||||
expect(cubit.state.fontFamily, builtInFontFamily);
|
||||
expect(cubit.state.fontFamily, builtInFontFamily());
|
||||
});
|
||||
|
||||
test('Fetch document appearance from SharedPreferences', () async {
|
||||
|
@ -1,10 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:appflowy/plugins/document/application/document_appearance_cubit.dart';
|
||||
import 'package:appflowy/plugins/document/presentation/editor_style.dart';
|
||||
import 'package:appflowy/workspace/application/settings/appearance/base_appearance.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:mocktail/mocktail.dart';
|
||||
|
||||
class MockDocumentAppearanceCubit extends Mock
|
||||
@ -34,14 +31,14 @@ void main() {
|
||||
});
|
||||
|
||||
test(
|
||||
'baseTextStyle should return the default TextStyle when an exception occurs',
|
||||
'baseTextStyle should return the null TextStyle when an exception occurs',
|
||||
() {
|
||||
const garbage = 'Garbage';
|
||||
final result = editorStyleCustomizer.baseTextStyle(garbage);
|
||||
expect(result, isA<TextStyle>());
|
||||
expect(
|
||||
result.fontFamily,
|
||||
GoogleFonts.getFont(builtInFontFamily).fontFamily,
|
||||
null,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
@ -1,10 +1,9 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:appflowy/plugins/document/application/document_appearance_cubit.dart';
|
||||
import 'package:appflowy/workspace/application/settings/appearance/appearance_cubit.dart';
|
||||
import 'package:appflowy/workspace/application/settings/appearance/base_appearance.dart';
|
||||
import 'package:appflowy/workspace/presentation/settings/widgets/settings_appearance/font_family_setting.dart';
|
||||
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:mocktail/mocktail.dart';
|
||||
@ -57,9 +56,9 @@ void main() {
|
||||
value: documentAppearanceCubit,
|
||||
),
|
||||
],
|
||||
child: const Scaffold(
|
||||
child: Scaffold(
|
||||
body: ThemeFontFamilySetting(
|
||||
currentFontFamily: builtInFontFamily,
|
||||
currentFontFamily: builtInFontFamily(),
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -72,7 +71,7 @@ void main() {
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Verify the initial font family
|
||||
expect(find.text(builtInFontFamily), findsAtLeastNWidgets(1));
|
||||
expect(find.text(builtInFontFamily()), findsAtLeastNWidgets(1));
|
||||
when(() => appearanceSettingsCubit.setFontFamily(any<String>()))
|
||||
.thenAnswer((_) async {});
|
||||
verifyNever(() => appearanceSettingsCubit.setFontFamily(any<String>()));
|
||||
|
Reference in New Issue
Block a user