TF-4370 Fix selector/key wiring: modal instantiation does not pass the key the test expects

This commit is contained in:
dab246
2026-03-25 15:53:44 +07:00
committed by Dat H. Pham
parent 0f9ea3c778
commit fdae057837
3 changed files with 8 additions and 3 deletions
@@ -21,8 +21,9 @@ class CreateNewATagScenario extends BaseTestScenario {
await $.pumpAndTrySettle();
await _expectCreateNewLabelModalVisible();
const newLabelName = 'Create new tag 1';
const newLabelDescription = 'Description tag 1';
final uniqueSuffix = DateTime.now().microsecondsSinceEpoch;
final newLabelName = 'Create new tag $uniqueSuffix';
final newLabelDescription = 'Description tag $uniqueSuffix';
await createLabelModalRobot.enterNewLabelName(newLabelName);
await createLabelModalRobot.enterNewLabelDescription(newLabelDescription);
await createLabelModalRobot.tapPositiveActionButton(LabelActionType.create);
@@ -148,6 +148,7 @@ class LabelController extends BaseController with LabelContextMenuMixin {
await DialogRouter().openDialogModal(
child: CreateNewLabelModal(
key: const Key('create_new_label_modal'),
labels: labels,
onLabelActionCallback: (label) => _createNewLabel(accountId, label),
),
@@ -363,6 +363,7 @@ class _CreateNewLabelModalState extends State<CreateNewLabelModal> {
void _clearInputFocus() {
_nameInputFocusNode.unfocus();
_descriptionInputFocusNode.unfocus();
}
void _onCreateNewLabel() {
@@ -373,7 +374,9 @@ class _CreateNewLabelModalState extends State<CreateNewLabelModal> {
color: _selectedColor != null
? HexColor(_selectedColor!.toHexTriplet())
: null,
description: _descriptionInputController.text,
description: _descriptionInputController.text.trim().isEmpty
? null
: _descriptionInputController.text.trim(),
);
widget.onLabelActionCallback(newLabel);