결재 템플릿 화면 위젯 테스트 추가

This commit is contained in:
JiWoong Sul
2025-09-25 15:23:50 +09:00
parent 1fbed565b7
commit 2accac85f3
2 changed files with 292 additions and 19 deletions

View File

@@ -212,8 +212,10 @@ class _ApprovalTemplateEnabledPageState
)
: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisSize: MainAxisSize.min,
children: [
Expanded(
SizedBox(
height: 480,
child: ShadTable.list(
header:
['ID', '템플릿코드', '템플릿명', '설명', '사용', '변경일시', '동작']
@@ -250,12 +252,11 @@ class _ApprovalTemplateEnabledPageState
),
),
ShadTableCell(
child: ShadBadge(
variant: template.isActive
? ShadBadgeVariant.defaultVariant
: ShadBadgeVariant.outline,
child: Text(template.isActive ? '사용' : '미사용'),
),
child: template.isActive
? const ShadBadge(child: Text('사용'))
: const ShadBadge.outline(
child: Text('미사용'),
),
),
ShadTableCell(
child: Text(
@@ -451,6 +452,7 @@ class _ApprovalTemplateEnabledPageState
final statusNotifier = ValueNotifier<bool>(template?.isActive ?? true);
bool isSaving = false;
String? errorText;
StateSetter? modalSetState;
final result = await showSuperportDialog<bool>(
context: context,
@@ -458,6 +460,7 @@ class _ApprovalTemplateEnabledPageState
barrierDismissible: !isSaving,
body: StatefulBuilder(
builder: (dialogContext, setModalState) {
modalSetState = setModalState;
final theme = ShadTheme.of(dialogContext);
return ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 640),
@@ -482,8 +485,8 @@ class _ApprovalTemplateEnabledPageState
label: '설명',
child: ShadTextarea(
controller: descriptionController,
minLines: 2,
maxLines: 4,
minHeight: 80,
maxHeight: 200,
),
),
_FormField(
@@ -510,8 +513,8 @@ class _ApprovalTemplateEnabledPageState
label: '비고',
child: ShadTextarea(
controller: noteController,
minLines: 2,
maxLines: 4,
minHeight: 80,
maxHeight: 200,
),
),
const SizedBox(height: 16),
@@ -594,19 +597,19 @@ class _ApprovalTemplateEnabledPageState
final codeValue = codeController.text.trim();
final nameValue = nameController.text.trim();
if (!isEdit && codeValue.isEmpty) {
setModalState(() => errorText = '템플릿 코드를 입력하세요.');
modalSetState?.call(() => errorText = '템플릿 코드를 입력하세요.');
return;
}
if (nameValue.isEmpty) {
setModalState(() => errorText = '템플릿명을 입력하세요.');
modalSetState?.call(() => errorText = '템플릿명을 입력하세요.');
return;
}
final validation = _validateSteps(steps);
if (validation != null) {
setModalState(() => errorText = validation);
modalSetState?.call(() => errorText = validation);
return;
}
setModalState(() => errorText = null);
modalSetState?.call(() => errorText = null);
final stepInputs = steps
.map(
(field) => ApprovalTemplateStepInput(
@@ -634,7 +637,7 @@ class _ApprovalTemplateEnabledPageState
: noteController.text.trim(),
isActive: statusNotifier.value,
);
setModalState(() => isSaving = true);
modalSetState?.call(() => isSaving = true);
final success = isEdit
? await _controller.update(
template!.id,
@@ -645,7 +648,7 @@ class _ApprovalTemplateEnabledPageState
if (success != null && mounted) {
Navigator.of(context).pop(true);
} else {
setModalState(() => isSaving = false);
modalSetState?.call(() => isSaving = false);
}
},
child: isSaving
@@ -812,8 +815,8 @@ class _StepEditorRow extends StatelessWidget {
const SizedBox(height: 8),
ShadTextarea(
controller: field.noteController,
minLines: 1,
maxLines: 3,
minHeight: 60,
maxHeight: 160,
placeholder: const Text('비고 (선택)'),
),
if (isEdit && field.id != null)