Commit 6d65f3f
Changed files (21)
lib
components
screens
lib/components/dialoges/add_export_column_dialoge.dart → lib/components/dialogues/add_export_column_dialogue.dart
@@ -8,22 +8,22 @@ import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:intl/intl.dart';
-/// Dialoge widget for creating and editing a [UserColumn].
+/// Dialogue widget for creating and editing a [UserColumn].
///
-/// For further documentation please refer to [showAddExportColumnDialoge].
-class AddExportColumnDialoge extends StatefulWidget {
+/// For further documentation please refer to [showAddExportColumnDialogue].
+class AddExportColumnDialogue extends StatefulWidget {
/// Create a widget for creating and editing a [UserColumn].
- const AddExportColumnDialoge({super.key, this.initialColumn, required this.settings});
+ const AddExportColumnDialogue({super.key, this.initialColumn, required this.settings});
final ExportColumn? initialColumn;
final Settings settings;
@override
- State<AddExportColumnDialoge> createState() => _AddExportColumnDialogeState();
+ State<AddExportColumnDialogue> createState() => _AddExportColumnDialogueState();
}
-class _AddExportColumnDialogeState extends State<AddExportColumnDialoge> with SingleTickerProviderStateMixin {
+class _AddExportColumnDialogueState extends State<AddExportColumnDialogue> with SingleTickerProviderStateMixin {
final formKey = GlobalKey<FormState>();
/// Csv column title used to compute internal identifier in case [widget.initialColumn] is null.
@@ -279,20 +279,20 @@ enum _FormatterType {
time,
}
-/// Shows a dialoge containing a export column editor to create a [UserColumn] or [TimeColumn].
+/// Shows a dialogue containing a export column editor to create a [UserColumn] or [TimeColumn].
///
/// In case [initialColumn] is null fields are initially empty.
/// When initialColumn is provided, it is ensured that the
/// returned column has the same [UserColumn.internalIdentifier].
///
-/// The dialoge allows entering a csv title and a format
+/// The dialogue allows entering a csv title and a format
/// pattern from which it generates a preview encoding and
/// shows values decode able.
///
/// Internal identifier and display title are generated from
/// the CSV title. There is no check whether a userColumn
/// with the generated title exists.
-Future<ExportColumn?> showAddExportColumnDialoge(BuildContext context, Settings settings, [ExportColumn? initialColumn]) =>
+Future<ExportColumn?> showAddExportColumnDialogue(BuildContext context, Settings settings, [ExportColumn? initialColumn]) =>
showDialog<ExportColumn?>(context: context, builder: (context) => Dialog.fullscreen(
- child: AddExportColumnDialoge(initialColumn: initialColumn, settings: settings,),
+ child: AddExportColumnDialogue(initialColumn: initialColumn, settings: settings,),
));
\ No newline at end of file
lib/components/dialoges/add_measurement.dart → lib/components/dialogues/add_measurement_dialogue.dart
@@ -11,16 +11,16 @@ import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:intl/intl.dart';
/// Input mask for entering measurements.
-class AddMeasurementDialoge extends StatefulWidget {
+class AddMeasurementDialogue extends StatefulWidget {
/// Create a input mask for entering measurements.
///
- /// This is usually created through the [showAddMeasurementDialoge] function.
- const AddMeasurementDialoge(
+ /// This is usually created through the [showAddMeasurementDialogue] function.
+ const AddMeasurementDialogue(
{super.key,
required this.settings,
this.initialRecord});
- /// Settings are followed by the dialoge.
+ /// Settings are followed by the dialogue.
final Settings settings;
/// Values that are prefilled.
@@ -29,10 +29,10 @@ class AddMeasurementDialoge extends StatefulWidget {
final BloodPressureRecord? initialRecord;
@override
- State<AddMeasurementDialoge> createState() => _AddMeasurementDialogeState();
+ State<AddMeasurementDialogue> createState() => _AddMeasurementDialogueState();
}
-class _AddMeasurementDialogeState extends State<AddMeasurementDialoge> {
+class _AddMeasurementDialogueState extends State<AddMeasurementDialogue> {
final formKey = GlobalKey<FormState>();
final sysFocusNode = FocusNode();
final diaFocusNode = FocusNode();
@@ -283,7 +283,7 @@ class _AddMeasurementDialogeState extends State<AddMeasurementDialoge> {
}
}
-Future<BloodPressureRecord?> showAddMeasurementDialoge(BuildContext context, Settings settings, [BloodPressureRecord? initialRecord]) =>
+Future<BloodPressureRecord?> showAddMeasurementDialogue(BuildContext context, Settings settings, [BloodPressureRecord? initialRecord]) =>
showDialog<BloodPressureRecord?>(context: context, builder: (context) => Dialog.fullscreen(
- child: AddMeasurementDialoge(settings: settings, initialRecord: initialRecord,),
+ child: AddMeasurementDialogue(settings: settings, initialRecord: initialRecord,),
));
\ No newline at end of file
lib/components/dialoges/enter_timeformat.dart → lib/components/dialogues/enter_timeformat_dialogue.dart
@@ -4,10 +4,10 @@ import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:intl/intl.dart';
-/// Dialoge that explains the time format and pops the context with either null or a time format string.
-class EnterTimeFormatDialoge extends StatefulWidget {
- /// Create dialoge for entering time formats as used by the [DateFormat] class.
- const EnterTimeFormatDialoge({super.key, required this.initialValue, this.previewTime});
+/// Dialogue that explains the time format and pops the context with either null or a time format string.
+class EnterTimeFormatDialogue extends StatefulWidget {
+ /// Create dialogue for entering time formats as used by the [DateFormat] class.
+ const EnterTimeFormatDialogue({super.key, required this.initialValue, this.previewTime});
/// Text that is initially in time format field.
final String initialValue;
@@ -18,10 +18,10 @@ class EnterTimeFormatDialoge extends StatefulWidget {
final DateTime? previewTime;
@override
- State<EnterTimeFormatDialoge> createState() => _EnterTimeFormatDialogeState();
+ State<EnterTimeFormatDialogue> createState() => _EnterTimeFormatDialogueState();
}
-class _EnterTimeFormatDialogeState extends State<EnterTimeFormatDialoge> {
+class _EnterTimeFormatDialogueState extends State<EnterTimeFormatDialogue> {
final timeFormatFieldController = TextEditingController();
final focusNode = FocusNode();
@@ -95,10 +95,10 @@ class _EnterTimeFormatDialogeState extends State<EnterTimeFormatDialoge> {
}
}
-/// Shows a dialoge that explains the ICU DateTime format and allows editing [initialTimeFormat] with a preview.
+/// Shows a dialogue that explains the ICU DateTime format and allows editing [initialTimeFormat] with a preview.
///
/// When canceled null is returned.
-Future<String?> showTimeFormatPickerDialoge(BuildContext context, String initialTimeFormat) =>
+Future<String?> showTimeFormatPickerDialogue(BuildContext context, String initialTimeFormat) =>
showDialog<String?>(context: context, builder: (context) => Dialog.fullscreen(
- child: EnterTimeFormatDialoge(initialValue: initialTimeFormat),
+ child: EnterTimeFormatDialogue(initialValue: initialTimeFormat),
));
\ No newline at end of file
lib/components/dialoges/input_dialoge.dart → lib/components/dialogues/input_dialogue.dart
@@ -2,12 +2,12 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
-/// Dialoge for prompting single value input from the user.
-class InputDialoge extends StatefulWidget {
+/// Dialogue for prompting single value input from the user.
+class InputDialogue extends StatefulWidget {
/// Creates an [AlertDialog] with an text input field.
///
/// Pops the context after value submission with object of type [String?].
- const InputDialoge({super.key,
+ const InputDialogue({super.key,
this.hintText,
this.initialValue,
this.inputFormatters,
@@ -27,18 +27,18 @@ class InputDialoge extends StatefulWidget {
/// Validation function called after submit.
///
- /// When the validator returns null the dialoge completes normally,
+ /// When the validator returns null the dialogue completes normally,
/// in case of receiving a String it will be displayed to the user
/// and pressing of the submit button will be ignored.
///
- /// It is still possible to cancel a dialoge in case the validator fails.
+ /// It is still possible to cancel a dialogue in case the validator fails.
final String? Function(String)? validator;
@override
- State<InputDialoge> createState() => _InputDialogeState();
+ State<InputDialogue> createState() => _InputDialogueState();
}
-class _InputDialogeState extends State<InputDialoge> {
+class _InputDialogueState extends State<InputDialogue> {
final controller = TextEditingController();
final focusNode = FocusNode();
@@ -97,20 +97,20 @@ class _InputDialogeState extends State<InputDialoge> {
}
}
-/// Creates a dialoge for prompting a single user input.
+/// Creates a dialogue for prompting a single user input.
///
/// Add supporting text describing the input field through [hintText].
/// [initialValue] specifies the initial input field content.
-Future<String?> showInputDialoge(BuildContext context, {String? hintText, String? initialValue}) async =>
+Future<String?> showInputDialogue(BuildContext context, {String? hintText, String? initialValue}) async =>
showDialog<String?>(context: context, builder: (context) =>
- InputDialoge(hintText: hintText, initialValue: initialValue,));
+ InputDialogue(hintText: hintText, initialValue: initialValue,));
-/// Creates a dialoge that only allows int and double inputs.
+/// Creates a dialogue that only allows int and double inputs.
///
-/// Variables behave similar to [showInputDialoge].
-Future<double?> showNumberInputDialoge(BuildContext context, {String? hintText, num? initialValue}) async {
+/// Variables behave similar to [showInputDialogue].
+Future<double?> showNumberInputDialogue(BuildContext context, {String? hintText, num? initialValue}) async {
final result = await showDialog<String?>(context: context, builder: (context) =>
- InputDialoge(
+ InputDialogue(
hintText: hintText,
initialValue: initialValue?.toString(),
inputFormatters: [FilteringTextInputFormatter.allow(RegExp(r'([0-9]+(\.([0-9]*))?)')),],
lib/components/measurement_list/measurement_list_entry.dart
@@ -1,4 +1,4 @@
-import 'package:blood_pressure_app/components/dialoges/add_measurement.dart';
+import 'package:blood_pressure_app/components/dialogues/add_measurement_dialogue.dart';
import 'package:blood_pressure_app/model/blood_pressure/model.dart';
import 'package:blood_pressure_app/model/blood_pressure/record.dart';
import 'package:blood_pressure_app/model/storage/storage.dart';
@@ -32,7 +32,7 @@ class MeasurementListRow extends StatelessWidget {
children: [
IconButton(
onPressed: () async {
- final future = showAddMeasurementDialoge(context, settings, record);
+ final future = showAddMeasurementDialogue(context, settings, record);
final model = Provider.of<BloodPressureModel>(context, listen: false);
final measurement = await future;
if (measurement == null) return;
lib/components/settings/input_list_tile.dart
@@ -1,4 +1,4 @@
-import 'package:blood_pressure_app/components/dialoges/input_dialoge.dart';
+import 'package:blood_pressure_app/components/dialogues/input_dialogue.dart';
import 'package:flutter/material.dart';
/// A list tile for exposing editable strings.
@@ -11,7 +11,7 @@ class InputListTile extends StatelessWidget {
/// Short label describing the required field contents.
///
- /// This will be both the title of the list tile as well as the hint text in the input dialoge.
+ /// This will be both the title of the list tile as well as the hint text in the input dialogue.
final String label;
/// Current content of the input field.
@@ -27,7 +27,7 @@ class InputListTile extends StatelessWidget {
subtitle: Text(value),
trailing: const Icon(Icons.edit),
onTap: () async {
- final input = await showInputDialoge(context, initialValue: value, hintText: label);
+ final input = await showInputDialogue(context, initialValue: value, hintText: label);
if (input != null) onSubmit(input);
},
);
lib/components/settings/number_input_list_tile.dart
@@ -1,4 +1,4 @@
-import 'package:blood_pressure_app/components/dialoges/input_dialoge.dart';
+import 'package:blood_pressure_app/components/dialogues/input_dialogue.dart';
import 'package:flutter/material.dart';
/// Widget for editing numbers in a list tile.
@@ -13,7 +13,7 @@ class NumberInputListTile extends StatelessWidget {
/// Short label describing the required field contents.
///
- /// This will be both the title of the list tile as well as the hint text in the input dialoge.
+ /// This will be both the title of the list tile as well as the hint text in the input dialogue.
final String label;
/// Widget to display before the label in the list tile.
@@ -33,7 +33,7 @@ class NumberInputListTile extends StatelessWidget {
leading: leading,
trailing: const Icon(Icons.edit),
onTap: () async {
- final result = await showNumberInputDialoge(context,
+ final result = await showNumberInputDialogue(context,
initialValue: value,
hintText: label
);
lib/screens/elements/legacy_measurement_list.dart
@@ -1,6 +1,6 @@
import 'dart:collection';
-import 'package:blood_pressure_app/components/dialoges/add_measurement.dart';
+import 'package:blood_pressure_app/components/dialogues/add_measurement_dialogue.dart';
import 'package:blood_pressure_app/model/blood_pressure/model.dart';
import 'package:blood_pressure_app/model/blood_pressure/record.dart';
import 'package:blood_pressure_app/model/storage/intervall_store.dart';
@@ -83,7 +83,7 @@ class LegacyMeasurementsList extends StatelessWidget {
confirmDismiss: (direction) async {
final model = Provider.of<BloodPressureModel>(context, listen: false);
if (direction == DismissDirection.startToEnd) { // edit
- final future = showAddMeasurementDialoge(context, settings, data[index]);
+ final future = showAddMeasurementDialogue(context, settings, data[index]);
final model = Provider.of<BloodPressureModel>(context, listen: false);
final measurement = await future;
if (measurement == null) return false;
@@ -94,7 +94,7 @@ class LegacyMeasurementsList extends StatelessWidget {
}
return false;
} else { // delete
- bool dialogeDeletionConfirmed = false;
+ bool dialogueDeletionConfirmed = false;
if (settings.confirmDeletion) {
await showDialog(
context: context,
@@ -110,7 +110,7 @@ class LegacyMeasurementsList extends StatelessWidget {
onPressed: () {
model.delete(data[index].creationTime);
- dialogeDeletionConfirmed = true;
+ dialogueDeletionConfirmed = true;
Navigator.of(context).pop();
},
child: Text(AppLocalizations.of(context)!.btnConfirm)),
@@ -119,10 +119,10 @@ class LegacyMeasurementsList extends StatelessWidget {
});
} else {
model.delete(data[index].creationTime);
- dialogeDeletionConfirmed = true;
+ dialogueDeletionConfirmed = true;
}
- if (dialogeDeletionConfirmed) {
+ if (dialogueDeletionConfirmed) {
if (!context.mounted) return true;
ScaffoldMessenger.of(context).removeCurrentSnackBar();
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
@@ -141,7 +141,7 @@ class LegacyMeasurementsList extends StatelessWidget {
),
));
}
- return dialogeDeletionConfirmed;
+ return dialogueDeletionConfirmed;
}
},
onDismissed: (direction) {},
lib/screens/subsettings/export_import/export_column_management_screen.dart
@@ -1,4 +1,4 @@
-import 'package:blood_pressure_app/components/dialoges/add_export_column_dialoge.dart';
+import 'package:blood_pressure_app/components/dialogues/add_export_column_dialogue.dart';
import 'package:blood_pressure_app/model/export_import/column.dart';
import 'package:blood_pressure_app/model/storage/export_columns_store.dart';
import 'package:blood_pressure_app/model/storage/settings_store.dart';
@@ -47,7 +47,7 @@ class ExportColumnsManagementScreen extends StatelessWidget {
icon: const Icon(Icons.edit),
onPressed: () async {
final settings = Provider.of<Settings>(context, listen: false);
- final editedColumn = await showAddExportColumnDialoge(context, settings, column);
+ final editedColumn = await showAddExportColumnDialogue(context, settings, column);
if (editedColumn != null) {
columnsManager.addOrUpdate(editedColumn);
}
@@ -82,13 +82,13 @@ class ExportColumnsManagementScreen extends StatelessWidget {
title: Text(localizations.addExportformat),
onTap: () async{
final settings = Provider.of<Settings>(context, listen: false);
- ExportColumn? editedColumn = await showAddExportColumnDialoge(context, settings);
+ ExportColumn? editedColumn = await showAddExportColumnDialogue(context, settings);
if (editedColumn != null) {
while (columnsManager.userColumns.containsKey(editedColumn!.internalIdentifier)) {
if (editedColumn is UserColumn) {
editedColumn = UserColumn.explicit('${editedColumn.internalIdentifier}I', editedColumn.csvTitle, editedColumn.formatPattern!);
} else {
- assert(editedColumn is TimeColumn, 'Creation of other types not supported in dialoge.');
+ assert(editedColumn is TimeColumn, 'Creation of other types not supported in dialogue.');
editedColumn = TimeColumn.explicit('${editedColumn.internalIdentifier}I', editedColumn.csvTitle, editedColumn.formatPattern!);
}
}
lib/screens/subsettings/delete_data_screen.dart
@@ -88,7 +88,7 @@ class _DeleteDataScreenState extends State<DeleteDataScreen> {
trailing: const Icon(Icons.delete_forever),
onTap: () async {
final messanger = ScaffoldMessenger.of(context);
- if (await showDeleteDialoge(context, localizations)) {
+ if (await showDeleteDialogue(context, localizations)) {
final String dbPath = join(await getDatabasesPath(), 'blood_pressure.db');
final String dbJournalPath = join(await getDatabasesPath(), 'blood_pressure.db-journal');
await closeDatabases();
@@ -125,7 +125,7 @@ class _DeleteDataScreenState extends State<DeleteDataScreen> {
trailing: const Icon(Icons.delete_forever),
onTap: () async {
final messanger = ScaffoldMessenger.of(context);
- if (await showDeleteDialoge(context, localizations)) {
+ if (await showDeleteDialogue(context, localizations)) {
final String dbPath = join(await getDatabasesPath(), 'config.db');
final String dbJournalPath = join(await getDatabasesPath(), 'config.db-journal');
await closeDatabases();
@@ -153,7 +153,7 @@ class _DeleteDataScreenState extends State<DeleteDataScreen> {
trailing: const Icon(Icons.delete_forever),
onTap: () async {
final messanger = ScaffoldMessenger.of(context);
- if (await showDeleteDialoge(context, localizations)) {
+ if (await showDeleteDialogue(context, localizations)) {
if (!context.mounted) return;
await unregisterAllProviders(context);
files[idx].deleteSync();
@@ -187,7 +187,7 @@ class _DeleteDataScreenState extends State<DeleteDataScreen> {
return '${(sizeBytes / pow(1024, i)).toStringAsFixed(1)} ${suffixes[i]}';
}
- Future<bool> showDeleteDialoge(BuildContext context, AppLocalizations localizations) async {
+ Future<bool> showDeleteDialogue(BuildContext context, AppLocalizations localizations) async {
return await showDialog<bool>(context: context, builder: (context) =>
AlertDialog(
title: Text(localizations.confirmDelete),
lib/screens/subsettings/graph_markings_screen.dart
@@ -1,5 +1,5 @@
import 'package:blood_pressure_app/components/color_picker.dart';
-import 'package:blood_pressure_app/components/dialoges/input_dialoge.dart';
+import 'package:blood_pressure_app/components/dialogues/input_dialogue.dart';
import 'package:blood_pressure_app/model/horizontal_graph_line.dart';
import 'package:blood_pressure_app/model/storage/settings_store.dart';
import 'package:flutter/material.dart';
@@ -40,7 +40,7 @@ class GraphMarkingsScreen extends StatelessWidget {
onTap: () async {
final color = await showColorPickerDialog(context);
if (!context.mounted) return;
- final height = await showNumberInputDialoge(context, hintText: localizations.linePositionY);
+ final height = await showNumberInputDialogue(context, hintText: localizations.linePositionY);
if (color == null || height == null) return;
lines.add(HorizontalGraphLine(color, height.round()));
lib/screens/home_screen.dart
@@ -1,4 +1,4 @@
-import 'package:blood_pressure_app/components/dialoges/add_measurement.dart';
+import 'package:blood_pressure_app/components/dialogues/add_measurement_dialogue.dart';
import 'package:blood_pressure_app/model/blood_pressure/model.dart';
import 'package:blood_pressure_app/model/storage/intervall_store.dart';
import 'package:blood_pressure_app/model/storage/settings_store.dart';
@@ -28,7 +28,7 @@ class AppHome extends StatelessWidget {
if (_appStart) {
if (Provider.of<Settings>(context, listen: false).startWithAddMeasurementPage) {
SchedulerBinding.instance.addPostFrameCallback((_) async {
- final future = showAddMeasurementDialoge(context, Provider.of<Settings>(context, listen: false));
+ final future = showAddMeasurementDialogue(context, Provider.of<Settings>(context, listen: false));
final model = Provider.of<BloodPressureModel>(context, listen: false);
final measurement = await future;
if (measurement == null) return;
@@ -94,7 +94,7 @@ class AppHome extends StatelessWidget {
tooltip: localizations.addMeasurement,
autofocus: true,
onPressed: () async {
- final future = showAddMeasurementDialoge(context, settings);
+ final future = showAddMeasurementDialogue(context, settings);
final model = Provider.of<BloodPressureModel>(context, listen: false);
final measurement = await future;
if (measurement == null) return;
lib/screens/settings_screen.dart
@@ -1,8 +1,8 @@
import 'dart:io';
import 'package:blood_pressure_app/components/consistent_future_builder.dart';
-import 'package:blood_pressure_app/components/dialoges/enter_timeformat.dart';
-import 'package:blood_pressure_app/components/dialoges/input_dialoge.dart';
+import 'package:blood_pressure_app/components/dialogues/enter_timeformat_dialogue.dart';
+import 'package:blood_pressure_app/components/dialogues/input_dialogue.dart';
import 'package:blood_pressure_app/components/settings/settings_widgets.dart';
import 'package:blood_pressure_app/model/blood_pressure/warn_values.dart';
import 'package:blood_pressure_app/model/iso_lang_names.dart';
@@ -45,7 +45,7 @@ class SettingsPage extends StatelessWidget {
leading: const Icon(Icons.schedule),
trailing: const Icon(Icons.arrow_forward_ios),
onTap: () async {
- final pickedFormat = await showTimeFormatPickerDialoge(context, settings.dateFormatString);
+ final pickedFormat = await showTimeFormatPickerDialogue(context, settings.dateFormatString);
if (pickedFormat != null) {
settings.dateFormatString = pickedFormat;
}
@@ -202,7 +202,7 @@ class SettingsPage extends StatelessWidget {
leading: const Icon(Icons.settings_applications_outlined),
title: Text(localizations.determineWarnValues),
onTap: () async {
- final age = (await showNumberInputDialoge(context,
+ final age = (await showNumberInputDialogue(context,
hintText: localizations.age,
))?.round();
if (age != null) {
test/ui/components/settings/input_list_tile_test.dart
@@ -1,4 +1,4 @@
-import 'package:blood_pressure_app/components/dialoges/input_dialoge.dart';
+import 'package:blood_pressure_app/components/dialogues/input_dialogue.dart';
import 'package:blood_pressure_app/components/settings/input_list_tile.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
@@ -28,15 +28,15 @@ void main() {
},
)));
- expect(find.byType(InputDialoge), findsNothing);
+ expect(find.byType(InputDialogue), findsNothing);
await widgetTester.tap(find.byType(InputListTile));
await widgetTester.pumpAndSettle();
- expect(find.byType(InputDialoge), findsOneWidget);
+ expect(find.byType(InputDialogue), findsOneWidget);
await widgetTester.tapAt(const Offset(0, 0));
await widgetTester.pumpAndSettle();
- expect(find.byType(InputDialoge), findsNothing);
+ expect(find.byType(InputDialogue), findsNothing);
});
testWidgets('should prefill value on edit', (widgetTester) async {
await widgetTester.pumpWidget(materialApp(InputListTile(
@@ -73,7 +73,7 @@ void main() {
await widgetTester.tap(find.text('OK'));
await widgetTester.pumpAndSettle();
- expect(find.byType(InputDialoge), findsNothing);
+ expect(find.byType(InputDialogue), findsNothing);
expect(callCount, 1);
});
});
test/ui/components/settings/number_input_list_tile_test.dart
@@ -1,4 +1,4 @@
-import 'package:blood_pressure_app/components/dialoges/input_dialoge.dart';
+import 'package:blood_pressure_app/components/dialogues/input_dialogue.dart';
import 'package:blood_pressure_app/components/settings/number_input_list_tile.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
@@ -28,15 +28,15 @@ void main() {
},
)));
- expect(find.byType(InputDialoge), findsNothing);
+ expect(find.byType(InputDialogue), findsNothing);
await widgetTester.tap(find.byType(NumberInputListTile));
await widgetTester.pumpAndSettle();
- expect(find.byType(InputDialoge), findsOneWidget);
+ expect(find.byType(InputDialogue), findsOneWidget);
await widgetTester.tapAt(const Offset(0, 0));
await widgetTester.pumpAndSettle();
- expect(find.byType(InputDialoge), findsNothing);
+ expect(find.byType(InputDialogue), findsNothing);
});
testWidgets('should prefill value on edit', (widgetTester) async {
await widgetTester.pumpWidget(materialApp(NumberInputListTile(
@@ -106,7 +106,7 @@ void main() {
await widgetTester.tap(find.text('OK'));
await widgetTester.pumpAndSettle();
- expect(find.byType(InputDialoge), findsNothing);
+ expect(find.byType(InputDialogue), findsNothing);
expect(callCount, 4);
});
});
test/ui/components/add_export_column_dialoge_test.dart
@@ -1,4 +1,4 @@
-import 'package:blood_pressure_app/components/dialoges/add_export_column_dialoge.dart';
+import 'package:blood_pressure_app/components/dialogues/add_export_column_dialogue.dart';
import 'package:blood_pressure_app/components/measurement_list/measurement_list_entry.dart';
import 'package:blood_pressure_app/model/export_import/column.dart';
import 'package:blood_pressure_app/model/storage/settings_store.dart';
@@ -10,9 +10,9 @@ import 'package:flutter_test/flutter_test.dart';
import 'util.dart';
void main() {
- group('AddExportColumnDialoge', () {
+ group('AddExportColumnDialogue', () {
testWidgets('should show everything on load', (widgetTester) async {
- await widgetTester.pumpWidget(materialApp(AddExportColumnDialoge(settings: Settings(),)));
+ await widgetTester.pumpWidget(materialApp(AddExportColumnDialogue(settings: Settings(),)));
expect(widgetTester.takeException(), isNull);
expect(find.text('SAVE'), findsOneWidget);
@@ -27,7 +27,7 @@ void main() {
});
testWidgets('should prefill values', (widgetTester) async {
await widgetTester.pumpWidget(materialApp(
- AddExportColumnDialoge(initialColumn: UserColumn('id', 'csvTitle', r'formatPattern$SYS'), settings: Settings(),)
+ AddExportColumnDialogue(initialColumn: UserColumn('id', 'csvTitle', r'formatPattern$SYS'), settings: Settings(),)
));
expect(widgetTester.takeException(), isNull);
@@ -43,7 +43,7 @@ void main() {
});
testWidgets('should show preview', (widgetTester) async {
await widgetTester.pumpWidget(materialApp(
- AddExportColumnDialoge(initialColumn: UserColumn('id', 'csvTitle', r'formatPattern$SYS'), settings: Settings(),)
+ AddExportColumnDialogue(initialColumn: UserColumn('id', 'csvTitle', r'formatPattern$SYS'), settings: Settings(),)
));
await widgetTester.pumpAndSettle();
@@ -53,7 +53,7 @@ void main() {
expect(find.textContaining('RowDataFieldType.sys'), findsOneWidget);
});
testWidgets('should open format Info screen', (widgetTester) async {
- await widgetTester.pumpWidget(materialApp(AddExportColumnDialoge(settings: Settings(),)));
+ await widgetTester.pumpWidget(materialApp(AddExportColumnDialogue(settings: Settings(),)));
expect(find.byType(InformationScreen), findsNothing);
@@ -64,27 +64,27 @@ void main() {
expect(find.byType(InformationScreen), findsOneWidget);
});
});
- group('showAddExportColumnDialoge', () {
- testWidgets('should open AddExportColumnDialoge', (widgetTester) async {
- await loadDialoge(widgetTester, (context) => showAddExportColumnDialoge(context, Settings()));
+ group('showAddExportColumnDialogue', () {
+ testWidgets('should open AddExportColumnDialogue', (widgetTester) async {
+ await loadDialogue(widgetTester, (context) => showAddExportColumnDialogue(context, Settings()));
- expect(find.byType(AddExportColumnDialoge), findsOneWidget);
+ expect(find.byType(AddExportColumnDialogue), findsOneWidget);
});
testWidgets('should return null on cancel', (widgetTester) async {
dynamic returnedValue = false;
- await loadDialoge(widgetTester, (context) async => returnedValue = await showAddExportColumnDialoge(context, Settings()));
+ await loadDialogue(widgetTester, (context) async => returnedValue = await showAddExportColumnDialogue(context, Settings()));
expect(returnedValue, false);
expect(find.byIcon(Icons.close), findsOneWidget);
await widgetTester.tap(find.byIcon(Icons.close));
await widgetTester.pumpAndSettle();
- expect(find.byType(AddExportColumnDialoge), findsNothing);
+ expect(find.byType(AddExportColumnDialogue), findsNothing);
expect(returnedValue, null);
});
testWidgets('should save entered values', (widgetTester) async {
dynamic returnedValue = false;
- await loadDialoge(widgetTester, (context) async => returnedValue = await showAddExportColumnDialoge(context, Settings()));
+ await loadDialogue(widgetTester, (context) async => returnedValue = await showAddExportColumnDialogue(context, Settings()));
final localizations = await AppLocalizations.delegate.load(const Locale('en'));
@@ -106,7 +106,7 @@ void main() {
await widgetTester.tap(find.text(localizations.btnSave));
await widgetTester.pumpAndSettle();
- expect(find.byType(AddExportColumnDialoge), findsNothing);
+ expect(find.byType(AddExportColumnDialogue), findsNothing);
expect(returnedValue, isA<UserColumn>()
.having((p0) => p0.csvTitle, 'csvTitle', 'testCsvTitle')
.having((p0) => p0.formatter.formatPattern, 'formatter', r'test$SYSformat'));
@@ -115,8 +115,8 @@ void main() {
final localizations = await AppLocalizations.delegate.load(const Locale('en'));
dynamic returnedValue = false;
- await loadDialoge(widgetTester, (context) async => returnedValue =
- await showAddExportColumnDialoge(context, Settings(),
+ await loadDialogue(widgetTester, (context) async => returnedValue =
+ await showAddExportColumnDialogue(context, Settings(),
UserColumn('initialInternalIdentifier', 'csvTitle', 'formatPattern')
));
@@ -132,7 +132,7 @@ void main() {
await widgetTester.tap(find.text(localizations.btnSave));
await widgetTester.pumpAndSettle();
- expect(find.byType(AddExportColumnDialoge), findsNothing);
+ expect(find.byType(AddExportColumnDialogue), findsNothing);
expect(returnedValue, isA<UserColumn>()
.having((p0) => p0.internalIdentifier, 'identifier', 'userColumn.initialInternalIdentifier'));
});
test/ui/components/add_measurement_dialoge_test.dart
@@ -1,4 +1,4 @@
-import 'package:blood_pressure_app/components/dialoges/add_measurement.dart';
+import 'package:blood_pressure_app/components/dialogues/add_measurement_dialogue.dart';
import 'package:blood_pressure_app/components/settings/color_picker_list_tile.dart';
import 'package:blood_pressure_app/model/blood_pressure/needle_pin.dart';
import 'package:blood_pressure_app/model/blood_pressure/record.dart';
@@ -13,10 +13,10 @@ import 'settings/color_picker_list_tile_test.dart';
import 'util.dart';
void main() {
- group('AddMeasurementDialoge', () {
+ group('AddMeasurementDialogue', () {
testWidgets('should show everything on initial page', (widgetTester) async {
await widgetTester.pumpWidget(materialApp(
- AddMeasurementDialoge(
+ AddMeasurementDialogue(
settings: Settings(),
)
));
@@ -30,7 +30,7 @@ void main() {
});
testWidgets('should prefill initialRecord values', (widgetTester) async {
await widgetTester.pumpWidget(materialApp(
- AddMeasurementDialoge(
+ AddMeasurementDialogue(
settings: Settings(),
initialRecord: BloodPressureRecord(
DateTime.now(), 123, 56, 43, 'Test note',
@@ -50,30 +50,30 @@ void main() {
having((p0) => p0.initialColor, 'ColorSelectionListTile should have correct initial color', Colors.teal));
});
});
- group('showAddMeasurementDialoge', () {
+ group('showAddMeasurementDialogue', () {
testWidgets('should return null on cancel', (widgetTester) async {
dynamic result = 'not null';
- await loadDialoge(widgetTester, (context) async
- => result = await showAddMeasurementDialoge(context, Settings(),
+ await loadDialogue(widgetTester, (context) async
+ => result = await showAddMeasurementDialogue(context, Settings(),
mockRecord(sys: 123, dia: 56, pul: 43, note: 'Test note', pin: Colors.teal)));
- expect(find.byType(AddMeasurementDialoge), findsOneWidget);
+ expect(find.byType(AddMeasurementDialogue), findsOneWidget);
await widgetTester.tap(find.byIcon(Icons.close));
await widgetTester.pumpAndSettle();
- expect(find.byType(AddMeasurementDialoge), findsNothing);
+ expect(find.byType(AddMeasurementDialogue), findsNothing);
expect(result, null);
});
testWidgets('should return values on cancel', (widgetTester) async {
dynamic result = 'not null';
final record = mockRecord(sys: 123, dia: 56, pul: 43, note: 'Test note', pin: Colors.teal);
- await loadDialoge(widgetTester, (context) async
- => result = await showAddMeasurementDialoge(context, Settings(), record));
+ await loadDialogue(widgetTester, (context) async
+ => result = await showAddMeasurementDialogue(context, Settings(), record));
- expect(find.byType(AddMeasurementDialoge), findsOneWidget);
+ expect(find.byType(AddMeasurementDialogue), findsOneWidget);
await widgetTester.tap(find.text('SAVE'));
await widgetTester.pumpAndSettle();
- expect(find.byType(AddMeasurementDialoge), findsNothing);
+ expect(find.byType(AddMeasurementDialogue), findsNothing);
expect(result, isA<BloodPressureRecord>().having(
(p0) => (p0.creationTime, p0.systolic, p0.diastolic, p0.pulse, p0.notes, p0.needlePin!.color),
@@ -82,8 +82,8 @@ void main() {
});
testWidgets('should be able to input values', (WidgetTester widgetTester) async {
dynamic result = 'not null';
- await loadDialoge(widgetTester, (context) async
- => result = await showAddMeasurementDialoge(context, Settings()));
+ await loadDialogue(widgetTester, (context) async
+ => result = await showAddMeasurementDialogue(context, Settings()));
await widgetTester.enterText(find.ancestor(of: find.text('Systolic').first, matching: find.byType(TextFormField)), '123');
await widgetTester.enterText(find.ancestor(of: find.text('Diastolic').first, matching: find.byType(TextFormField)), '67');
@@ -108,10 +108,10 @@ void main() {
expect(castResult.needlePin?.color, Colors.red);
});
testWidgets('should not allow invalid values', (widgetTester) async {
- await loadDialoge(widgetTester, (context) => showAddMeasurementDialoge(context, Settings()));
+ await loadDialogue(widgetTester, (context) => showAddMeasurementDialogue(context, Settings()));
final localizations = await AppLocalizations.delegate.load(const Locale('en'));
- expect(find.byType(AddMeasurementDialoge), findsOneWidget);
+ expect(find.byType(AddMeasurementDialogue), findsOneWidget);
expect(find.text(localizations.errNaN), findsNothing);
expect(find.text(localizations.errLt30), findsNothing);
expect(find.text(localizations.errUnrealistic), findsNothing);
@@ -122,7 +122,7 @@ void main() {
await widgetTester.tap(find.text('SAVE'));
await widgetTester.pumpAndSettle();
- expect(find.byType(AddMeasurementDialoge), findsOneWidget);
+ expect(find.byType(AddMeasurementDialogue), findsOneWidget);
expect(find.text(localizations.errNaN), findsOneWidget);
expect(find.text(localizations.errLt30), findsNothing);
expect(find.text(localizations.errUnrealistic), findsNothing);
@@ -131,7 +131,7 @@ void main() {
await widgetTester.enterText(find.ancestor(of: find.text('Pulse').first, matching: find.byType(TextFormField)), '20');
await widgetTester.tap(find.text('SAVE'));
await widgetTester.pumpAndSettle();
- expect(find.byType(AddMeasurementDialoge), findsOneWidget);
+ expect(find.byType(AddMeasurementDialogue), findsOneWidget);
expect(find.text(localizations.errNaN), findsNothing);
expect(find.text(localizations.errLt30), findsOneWidget);
expect(find.text(localizations.errUnrealistic), findsNothing);
@@ -141,7 +141,7 @@ void main() {
await widgetTester.enterText(find.ancestor(of: find.text('Diastolic').first, matching: find.byType(TextFormField)), '500');
await widgetTester.tap(find.text('SAVE'));
await widgetTester.pumpAndSettle();
- expect(find.byType(AddMeasurementDialoge), findsOneWidget);
+ expect(find.byType(AddMeasurementDialogue), findsOneWidget);
expect(find.text(localizations.errNaN), findsNothing);
expect(find.text(localizations.errLt30), findsNothing);
expect(find.text(localizations.errUnrealistic), findsOneWidget);
@@ -151,7 +151,7 @@ void main() {
await widgetTester.enterText(find.ancestor(of: find.text('Systolic').first, matching: find.byType(TextFormField)), '90');
await widgetTester.tap(find.text('SAVE'));
await widgetTester.pumpAndSettle();
- expect(find.byType(AddMeasurementDialoge), findsOneWidget);
+ expect(find.byType(AddMeasurementDialogue), findsOneWidget);
expect(find.text(localizations.errNaN), findsNothing);
expect(find.text(localizations.errLt30), findsNothing);
expect(find.text(localizations.errUnrealistic), findsNothing);
@@ -162,31 +162,31 @@ void main() {
await widgetTester.enterText(find.ancestor(of: find.text('Systolic').first, matching: find.byType(TextFormField)), '123');
await widgetTester.tap(find.text('SAVE'));
await widgetTester.pumpAndSettle();
- expect(find.byType(AddMeasurementDialoge), findsNothing);
+ expect(find.byType(AddMeasurementDialogue), findsNothing);
expect(find.text(localizations.errNaN), findsNothing);
expect(find.text(localizations.errLt30), findsNothing);
expect(find.text(localizations.errUnrealistic), findsNothing);
expect(find.text(localizations.errDiaGtSys), findsNothing);
});
testWidgets('should allow invalid values when setting is set', (widgetTester) async {
- await loadDialoge(widgetTester, (context) =>
- showAddMeasurementDialoge(context, Settings(validateInputs: false, allowMissingValues: true)));
+ await loadDialogue(widgetTester, (context) =>
+ showAddMeasurementDialogue(context, Settings(validateInputs: false, allowMissingValues: true)));
await widgetTester.enterText(find.ancestor(of: find.text('Systolic').first, matching: find.byType(TextFormField)), '2');
await widgetTester.enterText(find.ancestor(of: find.text('Diastolic').first, matching: find.byType(TextFormField)), '500');
await widgetTester.tap(find.text('SAVE'));
await widgetTester.pumpAndSettle();
- expect(find.byType(AddMeasurementDialoge), findsNothing);
+ expect(find.byType(AddMeasurementDialogue), findsNothing);
});
testWidgets('should respect settings.allowManualTimeInput', (widgetTester) async {
- await loadDialoge(widgetTester, (context) =>
- showAddMeasurementDialoge(context, Settings(allowManualTimeInput: false)));
+ await loadDialogue(widgetTester, (context) =>
+ showAddMeasurementDialogue(context, Settings(allowManualTimeInput: false)));
expect(find.byIcon(Icons.edit), findsNothing);
});
testWidgets('should start with sys input focused', (widgetTester) async {
- await loadDialoge(widgetTester, (context) =>
- showAddMeasurementDialoge(context, Settings(), mockRecord(sys: 12)));
+ await loadDialogue(widgetTester, (context) =>
+ showAddMeasurementDialogue(context, Settings(), mockRecord(sys: 12)));
final primaryFocus = FocusManager.instance.primaryFocus;
expect(primaryFocus?.context?.widget, isNotNull);
@@ -199,8 +199,8 @@ void main() {
.having((p0) => p0.initialValue, 'systolic content', '12'));
});
testWidgets('should focus next on input finished', (widgetTester) async {
- await loadDialoge(widgetTester, (context) =>
- showAddMeasurementDialoge(context, Settings(), mockRecord(sys: 12, dia: 3, pul: 4, note: 'note')));
+ await loadDialogue(widgetTester, (context) =>
+ showAddMeasurementDialogue(context, Settings(), mockRecord(sys: 12, dia: 3, pul: 4, note: 'note')));
await widgetTester.enterText(find.ancestor(of: find.text('Systolic').first, matching: find.byType(TextFormField)), '123');
@@ -240,8 +240,8 @@ void main() {
});
testWidgets('should focus last input field on backspace pressed in empty input field', (widgetTester) async {
- await loadDialoge(widgetTester, (context) =>
- showAddMeasurementDialoge(context, Settings(), mockRecord(sys: 12, dia: 3, pul: 4, note: 'note')));
+ await loadDialogue(widgetTester, (context) =>
+ showAddMeasurementDialogue(context, Settings(), mockRecord(sys: 12, dia: 3, pul: 4, note: 'note')));
await widgetTester.enterText(find.ancestor(of: find.text('note').first, matching: find.byType(TextFormField)), '');
test/ui/components/enter_timeformat_dialoge_test.dart
@@ -1,24 +1,24 @@
-import 'package:blood_pressure_app/components/dialoges/enter_timeformat.dart';
+import 'package:blood_pressure_app/components/dialogues/enter_timeformat_dialogue.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'util.dart';
void main() {
- group('EnterTimeFormatDialoge', () {
+ group('EnterTimeFormatDialogue', () {
testWidgets('should initialize without errors', (widgetTester) async {
- await widgetTester.pumpWidget(materialApp(const EnterTimeFormatDialoge(initialValue: 'yyyy-MM-dd HH:mm',)));
+ await widgetTester.pumpWidget(materialApp(const EnterTimeFormatDialogue(initialValue: 'yyyy-MM-dd HH:mm',)));
expect(widgetTester.takeException(), isNull);
- expect(find.byType(EnterTimeFormatDialoge), findsOneWidget);
+ expect(find.byType(EnterTimeFormatDialogue), findsOneWidget);
});
testWidgets('should prefill time format', (widgetTester) async {
- await widgetTester.pumpWidget(materialApp( const EnterTimeFormatDialoge(initialValue: 'yyyy-MM-dd HH:mm',)));
+ await widgetTester.pumpWidget(materialApp( const EnterTimeFormatDialogue(initialValue: 'yyyy-MM-dd HH:mm',)));
final textField = find.byType(TextField);
expect(textField, findsOneWidget);
expect(find.descendant(of: textField, matching: find.text('yyyy-MM-dd HH:mm')), findsOneWidget);
});
testWidgets('should show preview', (widgetTester) async {
- await widgetTester.pumpWidget(materialApp(EnterTimeFormatDialoge(
+ await widgetTester.pumpWidget(materialApp(EnterTimeFormatDialogue(
initialValue: 'yyyy-MM-dd HH:mm',
previewTime: DateTime(2023, 7, 23, 8, 20),
)
@@ -32,32 +32,32 @@ void main() {
expect(find.text('3rd quarter + July'), findsOneWidget);
});
testWidgets('should close page on close button pressed', (widgetTester) async {
- await widgetTester.pumpWidget(materialApp(const EnterTimeFormatDialoge(initialValue: 'yyyy-MM-dd HH:mm',)));
+ await widgetTester.pumpWidget(materialApp(const EnterTimeFormatDialogue(initialValue: 'yyyy-MM-dd HH:mm',)));
- expect(find.byType(EnterTimeFormatDialoge), findsOneWidget);
+ expect(find.byType(EnterTimeFormatDialogue), findsOneWidget);
expect(find.byIcon(Icons.close), findsOneWidget);
await widgetTester.tap(find.byIcon(Icons.close));
await widgetTester.pumpAndSettle();
- expect(find.byType(EnterTimeFormatDialoge), findsNothing);
+ expect(find.byType(EnterTimeFormatDialogue), findsNothing);
});
testWidgets('should not allow saving empty time formats', (widgetTester) async {
- await widgetTester.pumpWidget(materialApp(const EnterTimeFormatDialoge(initialValue: 'yyyy-MM-dd HH:mm',)));
+ await widgetTester.pumpWidget(materialApp(const EnterTimeFormatDialogue(initialValue: 'yyyy-MM-dd HH:mm',)));
await widgetTester.enterText(find.byType(TextField), '');
await widgetTester.pumpAndSettle();
expect(find.text('Please enter a value'), findsOneWidget);
- expect(find.byType(EnterTimeFormatDialoge), findsOneWidget);
+ expect(find.byType(EnterTimeFormatDialogue), findsOneWidget);
await widgetTester.tap(find.text('SAVE'));
- expect(find.byType(EnterTimeFormatDialoge), findsOneWidget);
+ expect(find.byType(EnterTimeFormatDialogue), findsOneWidget);
});
});
- group('showTimeFormatPickerDialoge', () {
+ group('showTimeFormatPickerDialogue', () {
testWidgets('should return null on close', (widgetTester) async {
String? result = 'notnull';
- await loadDialoge(widgetTester,
- (context) async => result = await showTimeFormatPickerDialoge(context, 'yyyy-MM-dd HH:mm'));
+ await loadDialogue(widgetTester,
+ (context) async => result = await showTimeFormatPickerDialogue(context, 'yyyy-MM-dd HH:mm'));
expect(find.byIcon(Icons.close), findsOneWidget);
await widgetTester.tap(find.byIcon(Icons.close));
@@ -67,8 +67,8 @@ void main() {
});
testWidgets('should return value on save', (widgetTester) async {
String? result;
- await loadDialoge(widgetTester,
- (context) async => result = await showTimeFormatPickerDialoge(context, 'yyyy-MM-dd HH:mm'));
+ await loadDialogue(widgetTester,
+ (context) async => result = await showTimeFormatPickerDialogue(context, 'yyyy-MM-dd HH:mm'));
expect(find.text('SAVE'), findsOneWidget);
await widgetTester.tap(find.text('SAVE'));
@@ -78,8 +78,8 @@ void main() {
});
testWidgets('should return modified value on save', (widgetTester) async {
String? result;
- await loadDialoge(widgetTester,
- (context) async => result = await showTimeFormatPickerDialoge(context, 'yyyy-MM-dd HH:mm'));
+ await loadDialogue(widgetTester,
+ (context) async => result = await showTimeFormatPickerDialogue(context, 'yyyy-MM-dd HH:mm'));
await widgetTester.enterText(find.byType(TextField), 'test text!');
await widgetTester.pumpAndSettle();
test/ui/components/input_dialoge_test.dart
@@ -1,4 +1,4 @@
-import 'package:blood_pressure_app/components/dialoges/input_dialoge.dart';
+import 'package:blood_pressure_app/components/dialogues/input_dialogue.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:flutter_test/flutter_test.dart';
@@ -6,22 +6,22 @@ import 'package:flutter_test/flutter_test.dart';
import 'util.dart';
void main() {
- group('InputDialoge', () {
+ group('InputDialogue', () {
testWidgets('should initialize without errors', (widgetTester) async {
- await widgetTester.pumpWidget(materialApp(const InputDialoge()));
+ await widgetTester.pumpWidget(materialApp(const InputDialogue()));
expect(widgetTester.takeException(), isNull);
await widgetTester.pumpWidget(const MaterialApp(
localizationsDelegates: [AppLocalizations.delegate,], locale: Locale('en'),
- home: InputDialoge(
+ home: InputDialogue(
hintText: 'test hint',
initialValue: 'initial text',
)
));
expect(widgetTester.takeException(), isNull);
- expect(find.byType(InputDialoge), findsOneWidget);
+ expect(find.byType(InputDialogue), findsOneWidget);
});
testWidgets('should show prefilled text', (widgetTester) async {
- await widgetTester.pumpWidget(materialApp(const InputDialoge(
+ await widgetTester.pumpWidget(materialApp(const InputDialogue(
hintText: 'test hint',
initialValue: 'initial text',
)));
@@ -29,7 +29,7 @@ void main() {
expect(find.text('test hint'), findsNWidgets(2));
});
testWidgets('should show validator errors', (widgetTester) async {
- await widgetTester.pumpWidget(materialApp(InputDialoge(
+ await widgetTester.pumpWidget(materialApp(InputDialogue(
initialValue: 'initial text',
validator: (_) => 'test error',
)));
@@ -39,12 +39,12 @@ void main() {
await widgetTester.tap(find.text(localizations.btnConfirm));
await widgetTester.pumpAndSettle();
- expect(find.byType(InputDialoge), findsOneWidget);
+ expect(find.byType(InputDialogue), findsOneWidget);
expect(find.text('test error'), findsOneWidget);
});
testWidgets('should send current text to validator', (widgetTester) async {
int validatorCalls = 0;
- await widgetTester.pumpWidget(materialApp(InputDialoge(
+ await widgetTester.pumpWidget(materialApp(InputDialogue(
initialValue: 'initial text',
validator: (value) {
expect(value, 'initial text');
@@ -62,14 +62,14 @@ void main() {
expect(validatorCalls, 1);
- expect(find.byType(InputDialoge), findsNothing);
+ expect(find.byType(InputDialogue), findsNothing);
});
});
- group('showInputDialoge', () {
+ group('showInputDialogue', () {
testWidgets('should start with input focused', (widgetTester) async {
- await loadDialoge(widgetTester, (context) => showInputDialoge(context, initialValue: 'testval'));
+ await loadDialogue(widgetTester, (context) => showInputDialogue(context, initialValue: 'testval'));
- expect(find.byType(InputDialoge), findsOneWidget);
+ expect(find.byType(InputDialogue), findsOneWidget);
final primaryFocus = FocusManager.instance.primaryFocus;
expect(primaryFocus?.context?.widget, isNotNull);
final focusedTextField = find.ancestor(
@@ -80,10 +80,10 @@ void main() {
});
testWidgets('should allow entering a value', (widgetTester) async {
String? result = 'init';
- await loadDialoge(widgetTester, (context) async => result = await showInputDialoge(context));
+ await loadDialogue(widgetTester, (context) async => result = await showInputDialogue(context));
final localizations = await AppLocalizations.delegate.load(const Locale('en'));
- expect(find.byType(InputDialoge), findsOneWidget);
+ expect(find.byType(InputDialogue), findsOneWidget);
expect(find.byType(TextField), findsOneWidget);
await widgetTester.enterText(find.byType(TextField), 'inputted text');
@@ -95,10 +95,10 @@ void main() {
});
testWidgets('should not return value on cancel', (widgetTester) async {
String? result = 'init';
- await loadDialoge(widgetTester, (context) async => result = await showInputDialoge(context, initialValue: 'test'));
+ await loadDialogue(widgetTester, (context) async => result = await showInputDialogue(context, initialValue: 'test'));
final localizations = await AppLocalizations.delegate.load(const Locale('en'));
- expect(find.byType(InputDialoge), findsOneWidget);
+ expect(find.byType(InputDialogue), findsOneWidget);
expect(find.byType(TextField), findsOneWidget);
await widgetTester.enterText(find.byType(TextField), 'inputted text');
@@ -109,11 +109,11 @@ void main() {
expect(result, null);
});
});
- group('showNumberInputDialoge', () {
+ group('showNumberInputDialogue', () {
testWidgets('should start with input focused', (widgetTester) async {
- await loadDialoge(widgetTester, (context) => showNumberInputDialoge(context, initialValue: 123));
+ await loadDialogue(widgetTester, (context) => showNumberInputDialogue(context, initialValue: 123));
- expect(find.byType(InputDialoge), findsOneWidget);
+ expect(find.byType(InputDialogue), findsOneWidget);
expect(find.text('123'), findsOneWidget);
final primaryFocus = FocusManager.instance.primaryFocus;
@@ -126,10 +126,10 @@ void main() {
});
testWidgets('should allow entering a number', (widgetTester) async {
double? result = -1;
- await loadDialoge(widgetTester, (context) async => result = await showNumberInputDialoge(context));
+ await loadDialogue(widgetTester, (context) async => result = await showNumberInputDialogue(context));
final localizations = await AppLocalizations.delegate.load(const Locale('en'));
- expect(find.byType(InputDialoge), findsOneWidget);
+ expect(find.byType(InputDialogue), findsOneWidget);
expect(find.byType(TextField), findsOneWidget);
await widgetTester.enterText(find.byType(TextField), '123.76');
@@ -141,17 +141,17 @@ void main() {
});
testWidgets('should not allow entering text', (widgetTester) async {
double? result = -1;
- await loadDialoge(widgetTester, (context) async => result = await showNumberInputDialoge(context));
+ await loadDialogue(widgetTester, (context) async => result = await showNumberInputDialogue(context));
final localizations = await AppLocalizations.delegate.load(const Locale('en'));
- expect(find.byType(InputDialoge), findsOneWidget);
+ expect(find.byType(InputDialogue), findsOneWidget);
await widgetTester.enterText(find.byType(TextField), 'test');
expect(find.text(localizations.btnConfirm), findsOneWidget);
await widgetTester.tap(find.text(localizations.btnConfirm));
await widgetTester.pumpAndSettle();
- expect(find.byType(InputDialoge), findsOneWidget); // unclosable through confirm
+ expect(find.byType(InputDialogue), findsOneWidget); // unclosable through confirm
expect(find.text(localizations.errNaN), findsOneWidget);
expect(find.text(localizations.btnCancel), findsOneWidget);
test/ui/components/util.dart
@@ -11,19 +11,19 @@ Widget materialApp(Widget child) {
);
}
-/// Open a dialoge through a button press.
+/// Open a dialogue through a button press.
///
/// Example usage:
/// ```dart
/// dynamic returnedValue = false;
-/// await loadDialoge(widgetTester, (context) async => returnedValue =
-/// await showAddExportColumnDialoge(context, Settings(),
+/// await loadDialogue(widgetTester, (context) async => returnedValue =
+/// await showAddExportColumnDialogue(context, Settings(),
/// UserColumn('initialInternalIdentifier', 'csvTitle', 'formatPattern')
/// ));
/// ```
-Future<void> loadDialoge(WidgetTester tester, void Function(BuildContext context) dialogeStarter, { String dialogeStarterText = 'X' }) async {
+Future<void> loadDialogue(WidgetTester tester, void Function(BuildContext context) dialogueStarter, { String dialogueStarterText = 'X' }) async {
await tester.pumpWidget(materialApp(Builder(builder: (context) =>
- TextButton(onPressed: () => dialogeStarter(context), child: Text(dialogeStarterText)))));
- await tester.tap(find.text(dialogeStarterText));
+ TextButton(onPressed: () => dialogueStarter(context), child: Text(dialogueStarterText)))));
+ await tester.tap(find.text(dialogueStarterText));
await tester.pumpAndSettle();
}
\ No newline at end of file