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,102 @@
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/product/domain/entities/product.dart';
import 'package:superport_v2/features/masters/product/presentation/dialogs/product_detail_dialog.dart';
import 'package:superport_v2/features/masters/vendor/domain/entities/vendor.dart';
import 'package:superport_v2/features/masters/uom/domain/entities/uom.dart';
import '../../../../../helpers/test_app.dart';
void main() {
final dateFormat = intl.DateFormat('yyyy-MM-dd HH:mm');
final vendorOptions = [
Vendor(id: 1, vendorCode: 'V-001', vendorName: '슈퍼벤더'),
];
final uomOptions = [Uom(id: 1, uomName: 'EA')];
Future<Product?> noopCreate(ProductInput _) async => null;
Future<Product?> noopUpdate(int _, ProductInput __) async => null;
Future<bool> noopDelete(int _) async => false;
Future<Product?> noopRestore(int _) async => null;
testWidgets('showProductDetailDialog 등록 모드는 입력 폼을 표시한다', (tester) async {
await tester.pumpWidget(buildTestApp(const SizedBox.shrink()));
final context = tester.element(find.byType(SizedBox));
unawaited(
showProductDetailDialog(
context: context,
dateFormat: dateFormat,
vendorOptions: vendorOptions,
uomOptions: uomOptions,
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('단위'), findsOneWidget);
expect(find.text('등록'), findsWidgets);
});
testWidgets('showProductDetailDialog 상세 모드는 기본/연결/히스토리 정보를 제공한다', (
tester,
) async {
await tester.binding.setSurfaceSize(const Size(1280, 800));
addTearDown(() => tester.binding.setSurfaceSize(null));
final product = Product(
id: 42,
productCode: 'P-100',
productName: '테스트 제품',
vendor: ProductVendor(id: 1, vendorCode: 'V-001', vendorName: '슈퍼벤더'),
uom: ProductUom(id: 1, uomName: 'EA'),
isActive: true,
isDeleted: false,
note: '비고 메모',
createdAt: DateTime(2024, 1, 1, 9),
updatedAt: DateTime(2024, 2, 2, 10),
);
await tester.pumpWidget(buildTestApp(const SizedBox.shrink()));
final context = tester.element(find.byType(SizedBox));
unawaited(
showProductDetailDialog(
context: context,
dateFormat: dateFormat,
product: product,
vendorOptions: vendorOptions,
uomOptions: uomOptions,
onCreate: noopCreate,
onUpdate: noopUpdate,
onDelete: noopDelete,
onRestore: noopRestore,
),
);
await tester.pumpAndSettle();
expect(find.text('제품 상세'), findsOneWidget);
expect(find.text('테스트 제품'), findsWidgets);
expect(find.text('제품코드'), findsOneWidget);
expect(find.text('연결 관계'), findsOneWidget);
await tester.tap(find.text('연결 관계'));
await tester.pumpAndSettle();
expect(find.textContaining('슈퍼벤더'), findsWidgets);
await tester.tap(find.text('히스토리'));
await tester.pumpAndSettle();
expect(find.textContaining('변경 이력 데이터는 준비 중입니다.'), findsOneWidget);
});
}

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/product/domain/entities/product.dart';
import 'package:superport_v2/features/masters/product/domain/repositories/product_repository.dart';
@@ -208,7 +209,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);
@@ -303,8 +304,7 @@ void main() {
await tester.tap(find.text('EA'));
await tester.pumpAndSettle();
await tester.tap(find.text('등록'));
await tester.pumpAndSettle();
await tester.tapShadButton('등록');
expect(capturedInput, isNotNull);
expect(capturedInput?.productCode, 'NP-001');