Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Update translation classes and metadata #319

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ SPEC CHECKSUMS:
package_info_plus: 115f4ad11e0698c8c1c5d8a689390df880f47e85
path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126
url_launcher_ios: 68d46cc9766d0c41dbdc884310529557e3cd7a86
url_launcher_ios: bf5ce03e0e2088bad9cc378ea97fa0ed5b49673b

PODFILE CHECKSUM: 0805b11bfb13bd44fc55fe52946ce14f22a2998e

COCOAPODS: 1.14.2
COCOAPODS: 1.14.3
2 changes: 1 addition & 1 deletion lib/i18n/strings.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"recipe" : {
"title" : "Recipe",
"empty" : "We've got no recipes.\nAdd your best ones!",
"empty" : "We've got no recipes.\nAdd your best ones!!",
"addRecipe" : "Add Recipe",
"newRecipe" : {
"title" : "New Recipe",
Expand Down
11 changes: 10 additions & 1 deletion lib/ui/recipe_note/edit/recipe_note_edit_view_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:buzz_recipe_viewer/model/isar/recipe_note.dart';
import 'package:buzz_recipe_viewer/service/recipe_note_service.dart';
import 'package:collection/collection.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:mockito/mockito.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';

part 'recipe_note_edit_view_model.freezed.dart';
Expand Down Expand Up @@ -54,7 +55,7 @@ class RecipeNoteEditState with _$RecipeNoteEditState {
bool get isValid => title.isNotEmpty && description.isNotEmpty;
}

@riverpod
@Riverpod(dependencies: [])
class RecipeNoteEditViewModel extends _$RecipeNoteEditViewModel {
late RecipeNoteService _recipeNoteService;
@override
Expand Down Expand Up @@ -142,3 +143,11 @@ extension RecipeNoteEditStateExtension on RecipeNoteEditState {
stepList.map((item) => item.text).toList(),
);
}

class FakeRecipeNoteEditViewModel extends _$RecipeNoteEditViewModel
with Mock
implements RecipeNoteEditViewModel {
@override
RecipeNoteEditState build({RecipeNote? recipeNote}) =>
const RecipeNoteEditState();
}
8 changes: 5 additions & 3 deletions lib/ui/recipe_note/edit/recipe_note_edit_view_model.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 43 additions & 0 deletions test/golden_test/recipe_note_edit_page_golden_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import 'package:buzz_recipe_viewer/i18n/strings.g.dart';
import 'package:buzz_recipe_viewer/ui/recipe_note/edit/recipe_note_edit_page.dart';
import 'package:buzz_recipe_viewer/ui/recipe_note/edit/recipe_note_edit_view_model.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:golden_toolkit/golden_toolkit.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';

import 'flutter_test_config.dart';

void main() {
final emptyDeviceBuilder = DeviceBuilder()
..addScenario(
widget: ProviderScope(
overrides: [
recipeNoteEditViewModelProvider()
.overrideWith(FakeRecipeNoteEditViewModel.new),
],
child: const RecipeNoteEditPage(),
),
);

group('recipe_note_edit', () {
testGoldens('ja', (tester) async {
const locale = AppLocale.ja;
LocaleSettings.setLocale(locale);
await tester.pumpDeviceBuilder(emptyDeviceBuilder, wrapper: wrapper);
await screenMatchesGolden(
tester,
'${locale.languageCode}/recipe_note_edit/empty',
);
});

testGoldens('en', (tester) async {
const locale = AppLocale.en;
LocaleSettings.setLocale(locale);
await tester.pumpDeviceBuilder(emptyDeviceBuilder, wrapper: wrapper);
await screenMatchesGolden(
tester,
'${locale.languageCode}/recipe_note_edit/empty',
);
});
});
}