mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-09-05 01:30:54 +03:00
fix(web-test): use target.y coordinates to find expand icon row
The expand/collapse code re-searched for the target row by first-cell text, which was ambiguous when parent and child rows share the same prefix (e.g. "БУ"). This caused expand to hit the wrong (already- expanded) row and skip. Use target.y from the initial findClickTarget instead — matches the exact row. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
66c6dc7aa1
commit
09bc0d00b8
@@ -2063,11 +2063,11 @@ export async function clickElement(text, { dblclick, table, toggle, expand, modi
|
|||||||
const grid = gridSel ? document.querySelector(gridSel) : document.querySelector('[id^="' + p + '"].grid');
|
const grid = gridSel ? document.querySelector(gridSel) : document.querySelector('[id^="' + p + '"].grid');
|
||||||
const body = grid?.querySelector('.gridBody');
|
const body = grid?.querySelector('.gridBody');
|
||||||
if (!body) return null;
|
if (!body) return null;
|
||||||
|
const targetY = ${target.y};
|
||||||
const lines = [...body.querySelectorAll('.gridLine')];
|
const lines = [...body.querySelectorAll('.gridLine')];
|
||||||
for (const line of lines) {
|
for (const line of lines) {
|
||||||
const textBoxes = [...line.querySelectorAll('.gridBoxText')].filter(b => b.offsetWidth > 0);
|
const lr = line.getBoundingClientRect();
|
||||||
const text = textBoxes[0]?.innerText?.trim() || '';
|
if (targetY < lr.top || targetY > lr.bottom) continue;
|
||||||
if (text.toLowerCase().replace(/ё/gi, 'е') === ${JSON.stringify(target.name.toLowerCase().replace(/ё/gi, 'е'))}) {
|
|
||||||
const icon = line.querySelector('.gridListH, .gridListV');
|
const icon = line.querySelector('.gridListH, .gridListV');
|
||||||
if (icon) {
|
if (icon) {
|
||||||
const r = icon.getBoundingClientRect();
|
const r = icon.getBoundingClientRect();
|
||||||
@@ -2075,7 +2075,6 @@ export async function clickElement(text, { dblclick, table, toggle, expand, modi
|
|||||||
return { x: Math.round(r.x + r.width / 2), y: Math.round(r.y + r.height / 2), isExpanded };
|
return { x: Math.round(r.x + r.width / 2), y: Math.round(r.y + r.height / 2), isExpanded };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
})()`);
|
})()`);
|
||||||
const shouldClick = toggle || !levelIconInfo
|
const shouldClick = toggle || !levelIconInfo
|
||||||
@@ -2112,11 +2111,11 @@ export async function clickElement(text, { dblclick, table, toggle, expand, modi
|
|||||||
const grid = gridSel ? document.querySelector(gridSel) : document.querySelector('[id^="' + p + '"].grid');
|
const grid = gridSel ? document.querySelector(gridSel) : document.querySelector('[id^="' + p + '"].grid');
|
||||||
const body = grid?.querySelector('.gridBody');
|
const body = grid?.querySelector('.gridBody');
|
||||||
if (!body) return null;
|
if (!body) return null;
|
||||||
|
const targetY = ${target.y};
|
||||||
const lines = [...body.querySelectorAll('.gridLine')];
|
const lines = [...body.querySelectorAll('.gridLine')];
|
||||||
for (const line of lines) {
|
for (const line of lines) {
|
||||||
const textBoxes = [...line.querySelectorAll('.gridBoxText')].filter(b => b.offsetWidth > 0);
|
const lr = line.getBoundingClientRect();
|
||||||
const text = textBoxes[0]?.innerText?.trim() || '';
|
if (targetY < lr.top || targetY > lr.bottom) continue;
|
||||||
if (text.toLowerCase().replace(/ё/gi, 'е') === ${JSON.stringify(target.name.toLowerCase().replace(/ё/gi, 'е'))}) {
|
|
||||||
const treeIcon = line.querySelector('.gridBoxImg [tree="true"]');
|
const treeIcon = line.querySelector('.gridBoxImg [tree="true"]');
|
||||||
if (treeIcon) {
|
if (treeIcon) {
|
||||||
const r = treeIcon.getBoundingClientRect();
|
const r = treeIcon.getBoundingClientRect();
|
||||||
@@ -2125,7 +2124,6 @@ export async function clickElement(text, { dblclick, table, toggle, expand, modi
|
|||||||
return { x: Math.round(r.x + r.width / 2), y: Math.round(r.y + r.height / 2), isExpanded };
|
return { x: Math.round(r.x + r.width / 2), y: Math.round(r.y + r.height / 2), isExpanded };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
})()`);
|
})()`);
|
||||||
const shouldClick = toggle || !treeIconInfo
|
const shouldClick = toggle || !treeIconInfo
|
||||||
|
|||||||
Reference in New Issue
Block a user