mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-08-21 10:39:42 +03:00
refactor(web-test): извлечены detect-new-form и edit-state из inline в dom/
Дедуплицированы 15 копий detect-new-form (13 в row-fill + 2 локальные
обёртки в select-value), 6 копий INPUT-focused, 4 проверки calendar/
calculator popup, 1 INPUT-focused-inside-grid.
Новое:
- dom/forms.mjs: detectNewFormScript(prev, {strict}) — объединяет broad
и strict варианты
- dom/edit-state.mjs: isInputFocusedScript({allowTextarea}),
isInputFocusedInGridScript, findOpenPopupScript
- helpers.mjs: переписан detectNewForm на dom-script; добавлены тонкие
обёртки isInputFocused, isInputFocusedInGrid, findOpenPopup
Метрики row-fill: 1235 → 1065 LOC (−170), inline page.evaluate 47 → 20.
Поведение идентично; точечный регресс зелёный (02/03/05/06/10/16).
04-selectvalue auto-history шаг — pre-existing baseline issue (state-
driven, не связан с S1, воспроизводится на HEAD).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
65ea06ab6e
commit
85003782db
@@ -14,8 +14,8 @@ import { highlight, unhighlight } from '../recording/highlight.mjs';
|
||||
import {
|
||||
safeClick, findFieldInputId, readEdd,
|
||||
detectNewForm as helperDetectNewForm,
|
||||
} from '../core/helpers.mjs';␍
|
||||
import { pasteText } from '../core/clipboard.mjs';
|
||||
} from '../core/helpers.mjs';
|
||||
import { pasteText } from '../core/clipboard.mjs';
|
||||
import { getFormState } from './state.mjs';
|
||||
|
||||
/**
|
||||
@@ -757,18 +757,9 @@ export async function selectValue(fieldName, searchText, { type } = {}) {
|
||||
if (!isChecked) { await page.click(cbSel); await waitForStable(); }
|
||||
}
|
||||
|
||||
// Helper: detect selection form (form number > formNum)
|
||||
// Helper: detect selection form (form number > formNum, strict mode)
|
||||
async function detectSelectionForm() {
|
||||
return page.evaluate(`(() => {
|
||||
const forms = {};
|
||||
document.querySelectorAll('input.editInput[id], a.press[id]').forEach(el => {
|
||||
if (el.offsetWidth === 0) return;
|
||||
const m = el.id.match(/^form(\\d+)_/);
|
||||
if (m) forms[m[1]] = true;
|
||||
});
|
||||
const nums = Object.keys(forms).map(Number).filter(n => n > ${formNum});
|
||||
return nums.length > 0 ? Math.max(...nums) : null;
|
||||
})()`);
|
||||
return helperDetectNewForm(formNum, { strict: true });
|
||||
}
|
||||
|
||||
// detectNewForm is hoisted at the top of selectValue (see above).
|
||||
|
||||
Reference in New Issue
Block a user