feat(dialog): 상세 팝업 SuperportDetailDialog 통합
- SuperportDetailDialog 위젯과 showSuperportDetailDialog 헬퍼를 추가하고 metadata/섹션 패턴을 표준화 - 결재/재고/마스터 각 상세 다이얼로그를 dialogs 디렉터리에 신설하고 기존 페이지를 신규 팝업으로 전환 - SuperportTable 행 선택과 우편번호 검색 다이얼로그 onRowTap 보정을 통해 헤더 오프셋 버그를 제거 - 상세 다이얼로그 및 트랜잭션/상세 뷰 전용 위젯 테스트와 tester_extensions 유틸을 추가하여 회귀를 방지 - detail_dialog_unification_plan.md로 작업 배경과 필드 통합 계획을 문서화
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:intl/intl.dart' as intl;
|
||||
|
||||
import 'package:superport_v2/features/inventory/inbound/presentation/models/inbound_record.dart';
|
||||
import 'package:superport_v2/features/inventory/inbound/presentation/widgets/inbound_detail_view.dart';
|
||||
|
||||
import '../../../../../helpers/test_app.dart';
|
||||
|
||||
void main() {
|
||||
final currencyFormatter = intl.NumberFormat.currency(
|
||||
locale: 'ko_KR',
|
||||
symbol: '₩',
|
||||
decimalDigits: 0,
|
||||
);
|
||||
|
||||
InboundRecord buildRecord() {
|
||||
return InboundRecord(
|
||||
id: 1,
|
||||
number: 'IN-1',
|
||||
transactionNumber: 'IN-1',
|
||||
transactionType: '입고',
|
||||
processedAt: DateTime(2024, 1, 1, 9),
|
||||
warehouse: '서울 1창고',
|
||||
status: '완료',
|
||||
writer: '홍길동',
|
||||
remark: '비고',
|
||||
items: [
|
||||
InboundLineItem(
|
||||
id: 10,
|
||||
product: '테스트 제품',
|
||||
manufacturer: '테스트 제조사',
|
||||
unit: 'EA',
|
||||
quantity: 3,
|
||||
price: 1000,
|
||||
remark: '정상',
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
testWidgets('InboundDetailView는 라인 품목과 경고 배지를 렌더링한다', (tester) async {
|
||||
final record = buildRecord();
|
||||
|
||||
await tester.pumpWidget(
|
||||
buildTestApp(
|
||||
InboundDetailView(
|
||||
record: record,
|
||||
currencyFormatter: currencyFormatter,
|
||||
transitionsEnabled: false,
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('재고 상태 전이가 비활성화된 상태입니다.'), findsOneWidget);
|
||||
expect(find.text('라인 품목'), findsOneWidget);
|
||||
expect(find.text('테스트 제품'), findsOneWidget);
|
||||
expect(find.text('테스트 제조사'), findsOneWidget);
|
||||
expect(find.text('EA'), findsOneWidget);
|
||||
expect(find.text('3'), findsWidgets);
|
||||
expect(find.text('₩1,000'), findsOneWidget);
|
||||
expect(find.text('정상'), findsOneWidget);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:intl/intl.dart' as intl;
|
||||
|
||||
import 'package:superport_v2/features/inventory/outbound/presentation/models/outbound_record.dart';
|
||||
import 'package:superport_v2/features/inventory/outbound/presentation/widgets/outbound_detail_view.dart';
|
||||
|
||||
import '../../../../../helpers/test_app.dart';
|
||||
|
||||
void main() {
|
||||
final currencyFormatter = intl.NumberFormat.currency(
|
||||
locale: 'ko_KR',
|
||||
symbol: '₩',
|
||||
decimalDigits: 0,
|
||||
);
|
||||
|
||||
OutboundRecord buildRecord() {
|
||||
return OutboundRecord(
|
||||
id: 1,
|
||||
number: 'OUT-1',
|
||||
transactionNumber: 'OUT-1',
|
||||
transactionType: '출고',
|
||||
processedAt: DateTime(2024, 2, 10, 11),
|
||||
warehouse: '서울 1창고',
|
||||
status: '출고 완료',
|
||||
writer: '관리자',
|
||||
remark: '긴급 출고',
|
||||
items: [
|
||||
OutboundLineItem(
|
||||
id: 20,
|
||||
product: '출고 제품',
|
||||
manufacturer: '제조사',
|
||||
unit: 'EA',
|
||||
quantity: 5,
|
||||
price: 2000,
|
||||
remark: '양호',
|
||||
),
|
||||
],
|
||||
customers: [
|
||||
OutboundCustomer(id: 1, customerId: 7, code: 'CUS-01', name: '테스트 고객'),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
testWidgets('OutboundDetailView는 고객 배지와 라인 테이블을 표시한다', (tester) async {
|
||||
final record = buildRecord();
|
||||
|
||||
await tester.pumpWidget(
|
||||
buildTestApp(
|
||||
OutboundDetailView(
|
||||
record: record,
|
||||
currencyFormatter: currencyFormatter,
|
||||
transitionsEnabled: true,
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('출고 고객사'), findsOneWidget);
|
||||
expect(find.text('테스트 고객 · CUS-01'), findsOneWidget);
|
||||
expect(find.text('라인 품목'), findsOneWidget);
|
||||
expect(find.text('출고 제품'), findsOneWidget);
|
||||
expect(find.text('제조사'), findsWidgets);
|
||||
expect(find.text('EA'), findsWidgets);
|
||||
expect(find.text('5'), findsWidgets);
|
||||
expect(find.text('₩2,000'), findsOneWidget);
|
||||
expect(find.text('양호'), findsOneWidget);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:intl/intl.dart' as intl;
|
||||
|
||||
import 'package:superport_v2/features/inventory/rental/presentation/models/rental_record.dart';
|
||||
import 'package:superport_v2/features/inventory/rental/presentation/widgets/rental_detail_view.dart';
|
||||
|
||||
import '../../../../../helpers/test_app.dart';
|
||||
|
||||
void main() {
|
||||
final currencyFormatter = intl.NumberFormat.currency(
|
||||
locale: 'ko_KR',
|
||||
symbol: '₩',
|
||||
decimalDigits: 0,
|
||||
);
|
||||
|
||||
RentalRecord buildRecord() {
|
||||
return RentalRecord(
|
||||
id: 1,
|
||||
number: 'RENT-1',
|
||||
transactionNumber: 'RENT-1',
|
||||
transactionType: '대여',
|
||||
rentalType: '대여',
|
||||
processedAt: DateTime(2024, 3, 5, 15),
|
||||
warehouse: '부산 창고',
|
||||
status: '반납 대기',
|
||||
writer: '김운영',
|
||||
remark: '대여 비고',
|
||||
returnDueDate: DateTime(2024, 3, 20),
|
||||
items: [
|
||||
RentalLineItem(
|
||||
id: 30,
|
||||
product: '대여 품목',
|
||||
manufacturer: '렌탈 제조사',
|
||||
unit: 'EA',
|
||||
quantity: 2,
|
||||
price: 5000,
|
||||
remark: '',
|
||||
),
|
||||
],
|
||||
customers: [
|
||||
RentalCustomer(id: 2, customerId: 9, code: 'RC-09', name: '렌탈 고객'),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
testWidgets('RentalDetailView는 고객 배지와 라인 테이블을 렌더링한다', (tester) async {
|
||||
final record = buildRecord();
|
||||
|
||||
await tester.pumpWidget(
|
||||
buildTestApp(
|
||||
RentalDetailView(
|
||||
record: record,
|
||||
currencyFormatter: currencyFormatter,
|
||||
transitionsEnabled: false,
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('재고 상태 전이가 비활성화된 상태입니다.'), findsOneWidget);
|
||||
expect(find.text('연결 고객사'), findsOneWidget);
|
||||
expect(find.text('렌탈 고객 · RC-09'), findsOneWidget);
|
||||
expect(find.text('라인 품목'), findsOneWidget);
|
||||
expect(find.text('대여 품목'), findsOneWidget);
|
||||
expect(find.text('렌탈 제조사'), findsOneWidget);
|
||||
expect(find.text('EA'), findsOneWidget);
|
||||
expect(find.text('2'), findsWidgets);
|
||||
expect(find.text('₩5,000'), findsOneWidget);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:shadcn_ui/shadcn_ui.dart';
|
||||
|
||||
import 'package:superport_v2/features/inventory/transactions/presentation/widgets/transaction_detail_dialog.dart';
|
||||
|
||||
import '../../../../../helpers/test_app.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets(
|
||||
'showInventoryTransactionDetailDialog는 summary/metadata/섹션을 렌더링한다',
|
||||
(tester) async {
|
||||
await tester.pumpWidget(buildTestApp(const SizedBox.shrink()));
|
||||
final context = tester.element(find.byType(SizedBox));
|
||||
|
||||
unawaited(
|
||||
showInventoryTransactionDetailDialog<void>(
|
||||
context: context,
|
||||
title: '트랜잭션 상세',
|
||||
description: '라인 품목과 상태를 확인하세요.',
|
||||
summary: const Text('TRX-123'),
|
||||
summaryBadges: const [ShadBadge(child: Text('완료'))],
|
||||
metadata: [
|
||||
SuperportDetailMetadata.text(label: '상태', value: '완료'),
|
||||
SuperportDetailMetadata.text(label: '창고', value: '서울 1창고'),
|
||||
],
|
||||
sections: [
|
||||
SuperportDetailDialogSection(
|
||||
id: 'lines',
|
||||
label: '라인 품목',
|
||||
builder: (_) => const Text('라인 섹션'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('트랜잭션 상세'), findsOneWidget);
|
||||
expect(find.text('TRX-123'), findsOneWidget);
|
||||
expect(find.text('상태'), findsOneWidget);
|
||||
expect(find.text('라인 섹션'), findsOneWidget);
|
||||
},
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user