task-p.4.3.1
This commit is contained in:
@@ -257,6 +257,8 @@ test('runtime restores legacy static labels into final template input', async ()
|
||||
assert.equal(runtime.assembled.templateInput.att_label, 'Att');
|
||||
assert.equal(runtime.assembled.templateInput.project_label, 'Project');
|
||||
assert.equal(runtime.assembled.templateInput.site_label, 'Location');
|
||||
assert.equal(runtime.assembled.templateInput.quotation_date, '2026-06-29');
|
||||
assert.equal(runtime.assembled.templateInput.quotation_date_data, '2026-06-29');
|
||||
});
|
||||
|
||||
test('template assembler does not overwrite populated values with nullish or blank patches', () => {
|
||||
|
||||
@@ -6,6 +6,7 @@ const LEGACY_STATIC_LABEL_DEFAULTS = {
|
||||
att_label: 'Att',
|
||||
project_label: 'Project',
|
||||
site_label: 'Location',
|
||||
quotation_date: '-',
|
||||
} as const;
|
||||
|
||||
function normalizeStringValue(
|
||||
@@ -24,8 +25,14 @@ export function resolveQuotationStaticTemplateInputs(
|
||||
documentData: QuotationDocumentData,
|
||||
): Record<string, unknown> {
|
||||
const labels = documentData.pdfme.labels;
|
||||
const quotationDate = normalizeStringValue(
|
||||
documentData.pdfme.quotation_date,
|
||||
LEGACY_STATIC_LABEL_DEFAULTS.quotation_date,
|
||||
);
|
||||
|
||||
return {
|
||||
quotation_date: quotationDate,
|
||||
quotation_date_data: quotationDate,
|
||||
tel_label: normalizeStringValue(
|
||||
labels.tel,
|
||||
LEGACY_STATIC_LABEL_DEFAULTS.tel_label,
|
||||
|
||||
Reference in New Issue
Block a user