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,91 @@
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:intl/intl.dart' as intl;
import 'package:superport_v2/features/masters/customer/domain/entities/customer.dart';
import 'package:superport_v2/features/masters/customer/presentation/dialogs/customer_detail_dialog.dart';
import '../../../../../helpers/test_app.dart';
void main() {
final dateFormat = intl.DateFormat('yyyy-MM-dd HH:mm');
Future<Customer?> noopCreate(CustomerInput _) async => null;
Future<Customer?> noopUpdate(int _, CustomerInput __) async => null;
Future<bool> noopDelete(int _) async => false;
Future<Customer?> noopRestore(int _) async => null;
testWidgets('showCustomerDetailDialog 등록 모드 폼을 렌더링한다', (tester) async {
await tester.pumpWidget(buildTestApp(const SizedBox.shrink()));
final context = tester.element(find.byType(SizedBox));
unawaited(
showCustomerDetailDialog(
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.text('등록'), findsWidgets);
});
testWidgets('showCustomerDetailDialog 상세 모드는 고객 요약을 표시한다', (tester) async {
await tester.binding.setSurfaceSize(const Size(1280, 800));
addTearDown(() => tester.binding.setSurfaceSize(null));
final customer = Customer(
id: 10,
customerCode: 'C-001',
customerName: '슈퍼고객',
contactName: '홍길동',
isPartner: true,
isGeneral: false,
email: 'customer@example.com',
mobileNo: '010-1111-2222',
zipcode: CustomerZipcode(
zipcode: '06000',
sido: '서울',
sigungu: '강남구',
roadName: '테헤란로',
),
addressDetail: '101호',
isActive: true,
isDeleted: false,
note: 'VIP',
createdAt: DateTime(2024, 3, 1, 9),
updatedAt: DateTime(2024, 3, 2, 10),
);
await tester.pumpWidget(buildTestApp(const SizedBox.shrink()));
final context = tester.element(find.byType(SizedBox));
unawaited(
showCustomerDetailDialog(
context: context,
dateFormat: dateFormat,
customer: customer,
onCreate: noopCreate,
onUpdate: noopUpdate,
onDelete: noopDelete,
onRestore: noopRestore,
),
);
await tester.pumpAndSettle();
expect(find.text('고객사 상세'), findsOneWidget);
expect(find.textContaining('슈퍼고객').first, findsOneWidget);
expect(find.text('고객사 코드'), findsWidgets);
expect(find.text('유형'), findsWidgets);
});
}

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/customer/domain/entities/customer.dart';
import 'package:superport_v2/features/masters/customer/domain/repositories/customer_repository.dart';
@@ -131,7 +132,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);
@@ -174,7 +175,7 @@ void main() {
await tester.enterText(fields.at(1), '검색 필요 고객');
await tester.enterText(fields.at(4), '06000');
await tester.tap(find.text('등록'));
await tester.tapShadButton('등록', settle: false);
await tester.pump();
expect(find.text('검색 버튼을 눌러 주소를 선택하세요.'), findsOneWidget);
@@ -251,11 +252,10 @@ void main() {
await tester.enterText(editableTexts.at(4), '02-0000-0000');
// 유형 체크박스: 기본값 partner=false, general=true. partner on 추가
await tester.tap(find.text('파트너'));
await tester.tap(find.text('파트너'), warnIfMissed: false);
await tester.pump();
await tester.tap(find.text('등록'));
await tester.pumpAndSettle();
await tester.tapShadButton('등록');
expect(capturedInput, isNotNull);
expect(capturedInput?.customerCode, 'C-100');