mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-07-30 00:16:56 +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,17 +2063,16 @@ 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();
|
const isExpanded = !!icon.classList.contains('gridListV');
|
||||||
const isExpanded = !!icon.classList.contains('gridListV');
|
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;
|
||||||
@@ -2112,18 +2111,17 @@ 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();
|
const bg = treeIcon.style.backgroundImage || '';
|
||||||
const bg = treeIcon.style.backgroundImage || '';
|
const isExpanded = bg.includes('gx=0');
|
||||||
const isExpanded = bg.includes('gx=0');
|
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;
|
||||||
|
|||||||
Reference in New Issue
Block a user