mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-07-15 23:35:17 +03:00
fix(web-test): клик по строке грида на узких модальных формах подбора
clickElement по строке грида целился в центр `.gridLine`, который на узкой модальной форме подбора со множеством колонок (≈2775px при окне ~894px) уезжал за пределы окна → mouse.click мимо строки, выделение не менялось (clickElement при этом рапортовал успех). Проявлялось на форме множественного выбора (F4). Общая логика клика вынесена в `ROW_CLICK_POINT_FN` (_shared.mjs): первая видимая текстовая ячейка строки (skip checkbox/picture, skip tree-toggle, кламп X). Фикс применён в findClickTargetScript (forms.mjs, row-select) и переиспользован в scanGridRowsScript (grid.mjs, дедупликация inline-блока — путь selectValue). Регресс: новый tests/web-test/20-modal-select-row.test.mjs (RED до фикса, GREEN после). Полный набор — 23/23. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
// web-test dom/forms v1.6 — form detection, content read, click-target/field-button resolution
|
||||
// web-test dom/forms v1.7 — form detection, content read, click-target/field-button resolution
|
||||
// Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
import { DETECT_FORM_FN, READ_FORM_FN } from './_shared.mjs';
|
||||
import { DETECT_FORM_FN, READ_FORM_FN, ROW_CLICK_POINT_FN } from './_shared.mjs';
|
||||
|
||||
/**
|
||||
* Detect the active form number.
|
||||
@@ -34,6 +34,7 @@ export function readFormScript(formNum) {
|
||||
export function findClickTargetScript(formNum, text, { tableName, gridSelector } = {}) {
|
||||
const p = `form${formNum}_`;
|
||||
return `(() => {
|
||||
${ROW_CLICK_POINT_FN}
|
||||
const norm = s => (s?.trim().replace(/\\u00a0/g, ' ') || '').replace(/ё/gi, 'е');
|
||||
const target = ${JSON.stringify(text.toLowerCase().replace(/ё/g, 'е'))};
|
||||
const p = ${JSON.stringify(p)};
|
||||
@@ -196,9 +197,14 @@ export function findClickTargetScript(formNum, text, { tableName, gridSelector }
|
||||
else if (isParent) kind = 'gridParent';
|
||||
else if (isTreeNode && hasChildren) kind = 'gridTreeNode';
|
||||
else kind = 'gridRow';
|
||||
// Click point: first visible text cell of the row, NOT the row-line centre.
|
||||
// A wide multi-column row's centre lands beyond the form's viewport (e.g. on
|
||||
// narrow modal selection forms) so mouse.click misses the row. See ROW_CLICK_POINT_FN.
|
||||
const pt = rowClickPoint(line, body);
|
||||
const r = line.getBoundingClientRect();
|
||||
return { id: '', kind, name: rowTexts[0] || '', gridId: grid.id,
|
||||
x: Math.round(r.x + r.width / 2), y: Math.round(r.y + r.height / 2) };
|
||||
x: pt ? pt.x : Math.round(r.x + r.width / 2),
|
||||
y: pt ? pt.y : Math.round(r.y + r.height / 2) };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user