feat(dialog): 상세 팝업 SuperportDetailDialog 통합
- SuperportDetailDialog 위젯과 showSuperportDetailDialog 헬퍼를 추가하고 metadata/섹션 패턴을 표준화 - 결재/재고/마스터 각 상세 다이얼로그를 dialogs 디렉터리에 신설하고 기존 페이지를 신규 팝업으로 전환 - SuperportTable 행 선택과 우편번호 검색 다이얼로그 onRowTap 보정을 통해 헤더 오프셋 버그를 제거 - 상세 다이얼로그 및 트랜잭션/상세 뷰 전용 위젯 테스트와 tester_extensions 유틸을 추가하여 회귀를 방지 - detail_dialog_unification_plan.md로 작업 배경과 필드 통합 계획을 문서화
This commit is contained in:
@@ -0,0 +1,89 @@
|
||||
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/warehouse/domain/entities/warehouse.dart';
|
||||
import 'package:superport_v2/features/masters/warehouse/presentation/dialogs/warehouse_detail_dialog.dart';
|
||||
|
||||
import '../../../../../helpers/test_app.dart';
|
||||
|
||||
void main() {
|
||||
final dateFormat = intl.DateFormat('yyyy-MM-dd HH:mm');
|
||||
|
||||
Future<Warehouse?> noopCreate(WarehouseInput _) async => null;
|
||||
Future<Warehouse?> noopUpdate(int _, WarehouseInput __) async => null;
|
||||
Future<bool> noopDelete(int _) async => false;
|
||||
Future<Warehouse?> noopRestore(int _) async => null;
|
||||
|
||||
testWidgets('showWarehouseDetailDialog 등록 모드 UI', (tester) async {
|
||||
await tester.pumpWidget(buildTestApp(const SizedBox.shrink()));
|
||||
final context = tester.element(find.byType(SizedBox));
|
||||
|
||||
unawaited(
|
||||
showWarehouseDetailDialog(
|
||||
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('showWarehouseDetailDialog 상세 모드 metadata/위험 섹션 제공', (
|
||||
tester,
|
||||
) async {
|
||||
await tester.binding.setSurfaceSize(const Size(1280, 800));
|
||||
addTearDown(() => tester.binding.setSurfaceSize(null));
|
||||
|
||||
final warehouse = Warehouse(
|
||||
id: 7,
|
||||
warehouseCode: 'WH-001',
|
||||
warehouseName: '서울 1창고',
|
||||
zipcode: WarehouseZipcode(zipcode: '06000', sido: '서울', sigungu: '강남구'),
|
||||
addressDetail: '강남대로 123',
|
||||
note: '비고',
|
||||
isActive: true,
|
||||
isDeleted: false,
|
||||
createdAt: DateTime(2024, 1, 1, 9),
|
||||
updatedAt: DateTime(2024, 1, 2, 10),
|
||||
);
|
||||
|
||||
await tester.pumpWidget(buildTestApp(const SizedBox.shrink()));
|
||||
final context = tester.element(find.byType(SizedBox));
|
||||
|
||||
unawaited(
|
||||
showWarehouseDetailDialog(
|
||||
context: context,
|
||||
dateFormat: dateFormat,
|
||||
warehouse: warehouse,
|
||||
onCreate: noopCreate,
|
||||
onUpdate: noopUpdate,
|
||||
onDelete: noopDelete,
|
||||
onRestore: noopRestore,
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('창고 상세'), findsOneWidget);
|
||||
expect(find.textContaining('서울 1창고'), findsWidgets);
|
||||
expect(find.text('기본주소'), findsOneWidget);
|
||||
expect(find.text('서울 강남구'), findsWidgets);
|
||||
expect(find.text('수정'), findsOneWidget);
|
||||
|
||||
await tester.tap(find.text('삭제'));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.textContaining('삭제하면 창고가'), findsOneWidget);
|
||||
});
|
||||
}
|
||||
@@ -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/warehouse/domain/entities/warehouse.dart';
|
||||
import 'package:superport_v2/features/masters/warehouse/domain/repositories/warehouse_repository.dart';
|
||||
@@ -152,7 +153,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);
|
||||
@@ -237,8 +238,7 @@ void main() {
|
||||
|
||||
await tester.enterText(updatedFields.at(3), '주소');
|
||||
|
||||
await tester.tap(find.text('등록'));
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tapShadButton('등록');
|
||||
|
||||
expect(capturedInput, isNotNull);
|
||||
expect(capturedInput?.warehouseCode, 'WH-100');
|
||||
|
||||
Reference in New Issue
Block a user