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 $.pumpAndTrySettle();
await _expectCreateNewLabelModalVisible(); await _expectCreateNewLabelModalVisible();
const newLabelName = 'Create new tag 1'; final uniqueSuffix = DateTime.now().microsecondsSinceEpoch;
const newLabelDescription = 'Description tag 1'; final newLabelName = 'Create new tag $uniqueSuffix';
final newLabelDescription = 'Description tag $uniqueSuffix';
await createLabelModalRobot.enterNewLabelName(newLabelName); await createLabelModalRobot.enterNewLabelName(newLabelName);
await createLabelModalRobot.enterNewLabelDescription(newLabelDescription); await createLabelModalRobot.enterNewLabelDescription(newLabelDescription);
await createLabelModalRobot.tapPositiveActionButton(LabelActionType.create); await createLabelModalRobot.tapPositiveActionButton(LabelActionType.create);
@@ -148,6 +148,7 @@ class LabelController extends BaseController with LabelContextMenuMixin {
await DialogRouter().openDialogModal( await DialogRouter().openDialogModal(
child: CreateNewLabelModal( child: CreateNewLabelModal(
key: const Key('create_new_label_modal'),
labels: labels, labels: labels,
onLabelActionCallback: (label) => _createNewLabel(accountId, label), onLabelActionCallback: (label) => _createNewLabel(accountId, label),
), ),
@@ -363,6 +363,7 @@ class _CreateNewLabelModalState extends State<CreateNewLabelModal> {
void _clearInputFocus() { void _clearInputFocus() {
_nameInputFocusNode.unfocus(); _nameInputFocusNode.unfocus();
_descriptionInputFocusNode.unfocus();
} }
void _onCreateNewLabel() { void _onCreateNewLabel() {
@@ -373,7 +374,9 @@ class _CreateNewLabelModalState extends State<CreateNewLabelModal> {
color: _selectedColor != null color: _selectedColor != null
? HexColor(_selectedColor!.toHexTriplet()) ? HexColor(_selectedColor!.toHexTriplet())
: null, : null,
description: _descriptionInputController.text, description: _descriptionInputController.text.trim().isEmpty
? null
: _descriptionInputController.text.trim(),
); );
widget.onLabelActionCallback(newLabel); widget.onLabelActionCallback(newLabel);