mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-08-20 10:09:42 +03:00
fix(web-test): skip includes() fuzzy match for short strings (< 4 chars)
Prevents false positives like "Да" matching "Удаляемые" (group) or "КомандаУстановитьВсе" (button). Exact and startsWith still work. Applied to highlight groups, findClickTargetScript buttons/grid-scoped/grid rows. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
7a6e63078d
commit
3e8a0a792f
@@ -4075,10 +4075,12 @@ export async function highlight(text, opts = {}) {
|
||||
return { id: el.id, name, label };
|
||||
});
|
||||
// Fuzzy match: exact label → exact name → startsWith → includes
|
||||
// Skip includes() for short strings (< 4 chars) to avoid false positives
|
||||
// e.g. "Да" matching "Удаляемые"
|
||||
let found = items.find(i => i.label === target);
|
||||
if (!found) found = items.find(i => i.name === target);
|
||||
if (!found) found = items.find(i => i.label.startsWith(target) || i.name.startsWith(target));
|
||||
if (!found) found = items.find(i => i.label.includes(target) || i.name.includes(target));
|
||||
if (!found && target.length >= 4) found = items.find(i => i.label.includes(target) || i.name.includes(target));
|
||||
return found ? found.id : null;
|
||||
})()`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user