fix(web-test): add Группа+name fallback for grid label extraction

On some forms, #title_div is on the parent group element
(e.g. form0_ГруппаБизнесПроцессы#title_div) rather than
on the grid itself. Add fallback lookup for both getFormState
and resolveGridScript.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Nick Shirokov
2026-03-14 12:11:10 +03:00
parent 91b5204ab2
commit 24a48b4a9f
+4 -2
View File
@@ -205,7 +205,8 @@ const READ_FORM_FN = `function readForm(p) {
}
const rowCount = body ? body.querySelectorAll('.gridLine').length : 0;
// Visual label from group title (e.g. "Входящие:" for grid "Входящие")
const titleEl = document.getElementById(p + name + '#title_div');
const titleEl = document.getElementById(p + name + '#title_div')
|| document.getElementById(p + 'Группа' + name + '#title_div');
const label = titleEl ? (titleEl.innerText?.trim().replace(/:\\s*$/, '').replace(/\\u00a0/g, ' ') || null) : null;
return { name, columns, rowCount, ...(label ? { label } : {}) };
});
@@ -395,7 +396,8 @@ export function resolveGridScript(formNum, tableName) {
});
}
// Visual label from group title element
const titleEl = document.getElementById(p + gridName + '#title_div');
const titleEl = document.getElementById(p + gridName + '#title_div')
|| document.getElementById(p + 'Группа' + gridName + '#title_div');
const label = titleEl ? (titleEl.innerText?.trim().replace(/:\s*$/, '').replace(/\u00a0/g, ' ') || '') : '';
return { idx, gridId, gridName, label, columns, el: g };
});