feat: expose form semantic documentation subjects
Module Package Release / publish-packages (push) Successful in 12s
Module Package Release / publish-packages (push) Successful in 12s
This commit is contained in:
@@ -1,8 +1,13 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
import unittest
|
||||
|
||||
from govoplan_forms.backend.manifest import manifest
|
||||
from govoplan_core.core.semantic_documentation import (
|
||||
SEMANTIC_DOCUMENTATION_SUBJECT_CONTRACT_VERSION,
|
||||
semantic_documentation_subject_capability,
|
||||
)
|
||||
|
||||
|
||||
class FormsInterfaceDocumentationContractTests(unittest.TestCase):
|
||||
@@ -25,6 +30,29 @@ class FormsInterfaceDocumentationContractTests(unittest.TestCase):
|
||||
self.assertIn("publish", reference.metadata["consequence_classes"])
|
||||
self.assertIn("import_package", reference.metadata["consequence_classes"])
|
||||
|
||||
def test_semantic_subject_provider_and_static_baseline_are_declared(self) -> None:
|
||||
capability = semantic_documentation_subject_capability("forms")
|
||||
self.assertIn("docs", manifest.optional_dependencies)
|
||||
self.assertNotIn("docs", manifest.dependencies)
|
||||
self.assertIn(capability, manifest.capability_factories)
|
||||
self.assertEqual(
|
||||
SEMANTIC_DOCUMENTATION_SUBJECT_CONTRACT_VERSION,
|
||||
manifest.capability_documentation[capability].contract_version,
|
||||
)
|
||||
topics = {topic.id: topic for topic in manifest.documentation}
|
||||
semantic = topics["forms.semantic-documentation"]
|
||||
self.assertEqual({"admin", "user"}, set(semantic.documentation_types))
|
||||
self.assertIn("cannot override", semantic.body)
|
||||
|
||||
def test_builder_links_semantic_help_without_closing_unsaved_dialog(self) -> None:
|
||||
source = (
|
||||
Path(__file__).parents[1]
|
||||
/ "webui/src/features/forms/FormDefinitionDialog.tsx"
|
||||
).read_text(encoding="utf-8")
|
||||
self.assertIn('target="_blank"', source)
|
||||
self.assertIn("semanticFieldDocumentation", source)
|
||||
self.assertIn("/docs/semantic?", source)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user