-
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
As in #670 shown was the course color picker broken. The issue for this was that `size` was null for the default colors. I also added a golden test to verify that the dialog is rendered correctly. ![image](https://github.com/SharezoneApp/sharezone-app/assets/24459435/954f3d2a-e32a-45b3-a9c8-02ce53b1efaf) Fixes #670
- Loading branch information
1 parent
883e6fc
commit df90608
Showing
4 changed files
with
84 additions
and
22 deletions.
There are no files selected for viewing
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
Binary file added
BIN
+69.7 KB
...src/pages/course/course_edit/design/src/dialog/goldens/select_design_dialog.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
55 changes: 55 additions & 0 deletions
55
...dens/groups/src/pages/course/course_edit/design/src/dialog/select_design_dialog_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,55 @@ | ||
// Copyright (c) 2022 Sharezone UG (haftungsbeschränkt) | ||
// Licensed under the EUPL-1.2-or-later. | ||
// | ||
// You may obtain a copy of the Licence at: | ||
// https://joinup.ec.europa.eu/software/page/eupl | ||
// | ||
// SPDX-License-Identifier: EUPL-1.2 | ||
|
||
import 'package:bloc_provider/bloc_provider.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:golden_toolkit/golden_toolkit.dart'; | ||
import 'package:sharezone/account/features/features_bloc.dart'; | ||
import 'package:sharezone/groups/src/pages/course/course_edit/design/course_edit_design.dart'; | ||
|
||
class MockFeatureBloc implements FeatureBloc { | ||
@override | ||
void dispose() {} | ||
|
||
@override | ||
Stream<bool> get isAllColorsUnlocked => Stream.value(true); | ||
} | ||
|
||
void main() { | ||
group('selectDesign', () { | ||
testGoldens('display select design dialog as expected', (tester) async { | ||
await tester.pumpWidget( | ||
BlocProvider<FeatureBloc>( | ||
bloc: MockFeatureBloc(), | ||
child: MaterialApp( | ||
home: Scaffold( | ||
body: Center( | ||
child: Builder(builder: (context) { | ||
return ElevatedButton( | ||
// @visibleForTesting is not working for our `test_goldens` | ||
// folder. Therefore we have to ignore the warning. | ||
// | ||
// ignore: invalid_use_of_visible_for_testing_member | ||
onPressed: () => selectDesign(context, null), | ||
child: Text("Select"), | ||
); | ||
}), | ||
), | ||
), | ||
), | ||
), | ||
); | ||
|
||
await tester.tap(find.byType(ElevatedButton)); | ||
await tester.pumpAndSettle(); | ||
|
||
await screenMatchesGolden(tester, 'select_design_dialog'); | ||
}); | ||
}); | ||
} |