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/vendor/domain/entities/vendor.dart';
import 'package:superport_v2/features/masters/vendor/presentation/dialogs/vendor_detail_dialog.dart';
import '../../../../../helpers/test_app.dart';
void main() {
final dateFormat = intl.DateFormat('yyyy-MM-dd HH:mm');
Future<Vendor?> noopCreate(VendorInput _) async => null;
Future<Vendor?> noopUpdate(int _, VendorInput __) async => null;
Future<bool> noopDelete(int _) async => false;
Future<Vendor?> noopRestore(int _) async => null;
testWidgets('showVendorDetailDialog 등록 모드 폼을 노출한다', (tester) async {
await tester.binding.setSurfaceSize(const Size(1080, 720));
addTearDown(() => tester.binding.setSurfaceSize(null));
await tester.pumpWidget(buildTestApp(const SizedBox.shrink()));
final context = tester.element(find.byType(SizedBox));
unawaited(
showVendorDetailDialog(
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('showVendorDetailDialog 상세 모드는 요약 정보를 제공한다', (tester) async {
await tester.binding.setSurfaceSize(const Size(1280, 800));
addTearDown(() => tester.binding.setSurfaceSize(null));
final vendor = Vendor(
id: 7,
vendorCode: 'V-007',
vendorName: '슈퍼벤더',
isActive: true,
isDeleted: false,
note: '테스트 벤더',
createdAt: DateTime(2024, 3, 1, 9, 30),
updatedAt: DateTime(2024, 3, 5, 12, 0),
);
await tester.pumpWidget(buildTestApp(const SizedBox.shrink()));
final context = tester.element(find.byType(SizedBox));
unawaited(
showVendorDetailDialog(
context: context,
dateFormat: dateFormat,
vendor: vendor,
onCreate: noopCreate,
onUpdate: noopUpdate,
onDelete: (id) async {
expect(id, equals(7));
return true;
},
onRestore: noopRestore,
),
);
await tester.pumpAndSettle();
expect(find.text('벤더 상세'), findsWidgets);
expect(find.text('슈퍼벤더'), findsWidgets);
expect(find.text('삭제 상태'), findsOneWidget);
expect(find.text('삭제'), findsOneWidget);
});
testWidgets('삭제 섹션에서 경고 메시지와 버튼을 노출한다', (tester) async {
await tester.binding.setSurfaceSize(const Size(1280, 800));
addTearDown(() => tester.binding.setSurfaceSize(null));
final vendor = Vendor(
id: 9,
vendorCode: 'V-009',
vendorName: '삭제 대상',
isActive: true,
isDeleted: false,
createdAt: DateTime(2024, 4, 1, 10),
updatedAt: DateTime(2024, 4, 10, 18),
);
await tester.pumpWidget(buildTestApp(const SizedBox.shrink()));
final context = tester.element(find.byType(SizedBox));
unawaited(
showVendorDetailDialog(
context: context,
dateFormat: dateFormat,
vendor: vendor,
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);
});
}

View File

@@ -5,6 +5,7 @@ import 'package:get_it/get_it.dart';
import 'package:mocktail/mocktail.dart';
import 'package:shadcn_ui/shadcn_ui.dart';
import '../../../../../helpers/tester_extensions.dart';
import 'package:superport_v2/core/common/models/paginated_result.dart';
import 'package:superport_v2/features/masters/vendor/domain/entities/vendor.dart';
import 'package:superport_v2/features/masters/vendor/domain/repositories/vendor_repository.dart';
@@ -142,7 +143,7 @@ void main() {
await tester.tap(find.text('신규 등록'));
await tester.pumpAndSettle();
await tester.tap(find.text('등록'));
await tester.tapShadButton('등록', settle: false);
await tester.pump();
expect(find.text('벤더코드를 입력하세요.'), findsOneWidget);
@@ -207,14 +208,14 @@ void main() {
await tester.enterText(editableTexts.at(0), 'NV-001');
await tester.enterText(editableTexts.at(1), '신규벤더');
await tester.tap(find.text('등록'));
await tester.tapShadButton('등록');
await tester.pumpAndSettle();
expect(find.byType(Dialog), findsNothing);
verify(() => repository.create(any())).called(1);
expect(capturedInput, isNotNull);
expect(capturedInput?.vendorCode, 'NV-001');
expect(find.byType(Dialog), findsNothing);
expect(find.text('NV-001'), findsOneWidget);
verify(() => repository.create(any())).called(1);
});
testWidgets('좁은 폭에서도 오버플로 없이 렌더링', (tester) async {