feat(dialog): 상세 팝업 SuperportDetailDialog 통합

- SuperportDetailDialog 위젯과 showSuperportDetailDialog 헬퍼를 추가하고 metadata/섹션 패턴을 표준화

- 결재/재고/마스터 각 상세 다이얼로그를 dialogs 디렉터리에 신설하고 기존 페이지를 신규 팝업으로 전환

- SuperportTable 행 선택과 우편번호 검색 다이얼로그 onRowTap 보정을 통해 헤더 오프셋 버그를 제거

- 상세 다이얼로그 및 트랜잭션/상세 뷰 전용 위젯 테스트와 tester_extensions 유틸을 추가하여 회귀를 방지

- detail_dialog_unification_plan.md로 작업 배경과 필드 통합 계획을 문서화
This commit is contained in:
JiWoong Sul
2025-11-07 19:02:43 +09:00
parent 1f78171294
commit 2f8b529506
64 changed files with 13721 additions and 7545 deletions

View File

@@ -0,0 +1,135 @@
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:intl/intl.dart' as intl;
import 'package:shadcn_ui/shadcn_ui.dart';
import 'package:superport_v2/features/masters/group/domain/entities/group.dart';
import 'package:superport_v2/features/masters/group/presentation/dialogs/group_detail_dialog.dart';
import '../../../../../helpers/test_app.dart';
void main() {
final dateFormat = intl.DateFormat('yyyy-MM-dd HH:mm');
Future<Group?> noopCreate(GroupInput _) async => null;
Future<Group?> noopUpdate(int _, GroupInput __) async => null;
Future<bool> noopDelete(int _) async => false;
Future<Group?> noopRestore(int _) async => null;
testWidgets('showGroupDetailDialog 등록 모드 폼을 노출한다', (tester) async {
await tester.binding.setSurfaceSize(const Size(960, 720));
addTearDown(() => tester.binding.setSurfaceSize(null));
await tester.pumpWidget(buildTestApp(const SizedBox.shrink()));
final context = tester.element(find.byType(SizedBox));
unawaited(
showGroupDetailDialog(
context: context,
dateFormat: dateFormat,
onCreate: noopCreate,
onUpdate: noopUpdate,
onDelete: noopDelete,
onRestore: noopRestore,
),
);
await tester.pumpAndSettle();
expect(find.text('그룹 등록'), findsOneWidget);
expect(find.text('그룹명'), findsOneWidget);
expect(find.text('설명'), findsOneWidget);
expect(find.widgetWithText(ShadButton, '등록'), findsWidgets);
});
testWidgets('showGroupDetailDialog 상세 모드는 요약과 메타데이터를 제공한다', (tester) async {
await tester.binding.setSurfaceSize(const Size(1280, 800));
addTearDown(() => tester.binding.setSurfaceSize(null));
final group = Group(
id: 12,
groupName: '운영팀',
description: '운영 담당',
isDefault: false,
isActive: true,
isDeleted: false,
note: '연중무휴',
createdAt: DateTime(2024, 2, 1, 9),
updatedAt: DateTime(2024, 3, 1, 10),
);
await tester.pumpWidget(buildTestApp(const SizedBox.shrink()));
final context = tester.element(find.byType(SizedBox));
unawaited(
showGroupDetailDialog(
context: context,
dateFormat: dateFormat,
group: group,
onCreate: noopCreate,
onUpdate: noopUpdate,
onDelete: noopDelete,
onRestore: noopRestore,
),
);
await tester.pumpAndSettle();
expect(find.text('그룹 상세'), findsWidgets);
expect(find.text('운영팀'), findsWidgets);
expect(find.text('운영 담당'), findsWidgets);
expect(find.text('기본 여부'), findsWidgets);
expect(find.text('사용 여부'), findsWidgets);
expect(find.text('삭제'), findsOneWidget);
});
testWidgets('삭제 섹션에서 경고와 버튼 상태를 노출한다', (tester) async {
await tester.binding.setSurfaceSize(const Size(1280, 800));
addTearDown(() => tester.binding.setSurfaceSize(null));
final group = Group(
id: 20,
groupName: '삭제 대상',
isDefault: false,
isActive: true,
isDeleted: false,
createdAt: DateTime(2024, 1, 10, 8),
updatedAt: DateTime(2024, 1, 12, 9),
);
await tester.pumpWidget(buildTestApp(const SizedBox.shrink()));
final context = tester.element(find.byType(SizedBox));
unawaited(
showGroupDetailDialog(
context: context,
dateFormat: dateFormat,
group: group,
onCreate: noopCreate,
onUpdate: noopUpdate,
onDelete: (_) async => true,
onRestore: noopRestore,
),
);
await tester.pumpAndSettle();
final deleteTab = find.text('삭제').first;
await tester.tap(deleteTab, warnIfMissed: false);
await tester.pumpAndSettle();
expect(find.textContaining('삭제하면'), findsOneWidget);
final dialog = find.byType(Dialog);
final deleteButton = find
.descendant(
of: dialog,
matching: find.widgetWithText(ShadButton, '삭제', skipOffstage: false),
)
.first;
final buttonWidget = tester.widget<ShadButton>(deleteButton);
expect(buttonWidget.onPressed, isNotNull);
});
}