Load EDT form elements on demand
CI / python (push) Has been cancelled
CI / rust (push) Has been cancelled

This commit is contained in:
2026-05-21 06:57:06 +03:00
parent 7d4d9917dd
commit 8b9a076d86
4 changed files with 209 additions and 9 deletions
@@ -373,6 +373,38 @@ def test_index_project_extracts_managed_form_items_without_layouts(tmp_path: Pat
assert not any(element.name == "ПечатнаяФорма" for element in form.elements)
def test_index_project_extracts_edt_form_items_from_form_file_path(tmp_path: Path):
form_dir = tmp_path / "src" / "Catalogs" / "ВидыЗаказовПокупателей" / "Forms" / "ФормаСписка"
form_dir.mkdir(parents=True)
(form_dir / "Form.form").write_text(
"""
<form:Form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:form="http://g5.1c.ru/v8/dt/form">
<items xsi:type="form:Table">
<name>Список</name>
<dataPath xsi:type="form:DataPath">
<segments>Список</segments>
</dataPath>
<items xsi:type="form:FormField">
<name>Наименование</name>
<dataPath xsi:type="form:DataPath">
<segments>Список.Description</segments>
</dataPath>
</items>
</items>
</form:Form>
""",
encoding="utf-8",
)
snapshot = index_project(tmp_path, project_id="edt-form-items")
form = next(item for item in form_semantics(snapshot) if item.form.name == "ФормаСписка")
assert form.form.qualified_name == "Справочник.ВидыЗаказовПокупателей.ФормаСписка"
assert [element.name for element in form.elements] == ["Список", "Наименование"]
assert form.elements[0].attributes["control_kind"] == "Table"
assert form.elements[1].attributes["dataPath"] == "Список.Description"
def test_index_project_links_form_events_to_handlers(tmp_path: Path):
xml = tmp_path / "form.xml"
xml.write_text(