From 8df3665e27d02a858d7924836895b85c26c0aa7d Mon Sep 17 00:00:00 2001 From: Stanislav Pankevich Date: Sun, 16 Jul 2023 19:42:29 +0200 Subject: [PATCH] export/html, server: fix edge case when dropping a req on another req Closes #1232 --- strictdoc/server/routers/main_router.py | 8 ++++++++ .../test_UC60_T01_document_has_no_content.py | 5 ++--- .../test_UC60_T02_document_has_content.py | 5 ++--- .../test_UC30_T01_document_has_no_content.py | 5 ++--- .../test_UC30_T02_document_has_content.py | 5 ++--- 5 files changed, 16 insertions(+), 12 deletions(-) diff --git a/strictdoc/server/routers/main_router.py b/strictdoc/server/routers/main_router.py index f0691b9da..9a835ce9f 100644 --- a/strictdoc/server/routers/main_router.py +++ b/strictdoc/server/routers/main_router.py @@ -1384,6 +1384,14 @@ async def move_node(request: Request): ) current_parent_node = moved_node.parent + # Currently UI allows a child-like drag-and-drop on a requirement node. + # In that case, we make it add a node **after** the target requirement + # node (not as its child because that's not possible). + if whereto == NodeCreationOrder.CHILD and isinstance( + target_node, Requirement + ): + whereto = NodeCreationOrder.AFTER + if whereto == NodeCreationOrder.CHILD: # Disconnect the moved_node from its parent. current_parent_node.section_contents.remove(moved_node) diff --git a/tests/end2end/screens/table/UC60_view_document/UC60_T01_document_has_no_content/test_UC60_T01_document_has_no_content.py b/tests/end2end/screens/table/UC60_view_document/UC60_T01_document_has_no_content/test_UC60_T01_document_has_no_content.py index a1fc84d2a..4397141cb 100644 --- a/tests/end2end/screens/table/UC60_view_document/UC60_T01_document_has_no_content/test_UC60_T01_document_has_no_content.py +++ b/tests/end2end/screens/table/UC60_view_document/UC60_T01_document_has_no_content/test_UC60_T01_document_has_no_content.py @@ -1,5 +1,4 @@ -from seleniumbase import BaseCase - +from tests.end2end.e2e_case import E2ECase from tests.end2end.end2end_test_setup import End2EndTestSetup from tests.end2end.helpers.components.viewtype_selector import ViewType_Selector from tests.end2end.helpers.screens.project_index.screen_project_index import ( @@ -8,7 +7,7 @@ from tests.end2end.server import SDocTestServer -class Test_UC60_T01_document_has_no_content(BaseCase): +class Test(E2ECase): def test(self): test_setup = End2EndTestSetup(path_to_test_file=__file__) diff --git a/tests/end2end/screens/table/UC60_view_document/UC60_T02_document_has_content/test_UC60_T02_document_has_content.py b/tests/end2end/screens/table/UC60_view_document/UC60_T02_document_has_content/test_UC60_T02_document_has_content.py index 460b0d3a4..de8e83b42 100644 --- a/tests/end2end/screens/table/UC60_view_document/UC60_T02_document_has_content/test_UC60_T02_document_has_content.py +++ b/tests/end2end/screens/table/UC60_view_document/UC60_T02_document_has_content/test_UC60_T02_document_has_content.py @@ -1,5 +1,4 @@ -from seleniumbase import BaseCase - +from tests.end2end.e2e_case import E2ECase from tests.end2end.end2end_test_setup import End2EndTestSetup from tests.end2end.helpers.components.viewtype_selector import ViewType_Selector from tests.end2end.helpers.screens.project_index.screen_project_index import ( @@ -8,7 +7,7 @@ from tests.end2end.server import SDocTestServer -class Test_UC60_T02_document_has_content(BaseCase): +class Test(E2ECase): def test(self): test_setup = End2EndTestSetup(path_to_test_file=__file__) diff --git a/tests/end2end/screens/traceability/UC30_view_document/UC30_T01_document_has_no_content/test_UC30_T01_document_has_no_content.py b/tests/end2end/screens/traceability/UC30_view_document/UC30_T01_document_has_no_content/test_UC30_T01_document_has_no_content.py index 09547bfdb..8496f3eeb 100644 --- a/tests/end2end/screens/traceability/UC30_view_document/UC30_T01_document_has_no_content/test_UC30_T01_document_has_no_content.py +++ b/tests/end2end/screens/traceability/UC30_view_document/UC30_T01_document_has_no_content/test_UC30_T01_document_has_no_content.py @@ -1,5 +1,4 @@ -from seleniumbase import BaseCase - +from tests.end2end.e2e_case import E2ECase from tests.end2end.end2end_test_setup import End2EndTestSetup from tests.end2end.helpers.components.viewtype_selector import ViewType_Selector from tests.end2end.helpers.screens.project_index.screen_project_index import ( @@ -8,7 +7,7 @@ from tests.end2end.server import SDocTestServer -class Test_UC30_T01_document_has_no_content(BaseCase): +class Test(E2ECase): def test(self): test_setup = End2EndTestSetup(path_to_test_file=__file__) diff --git a/tests/end2end/screens/traceability/UC30_view_document/UC30_T02_document_has_content/test_UC30_T02_document_has_content.py b/tests/end2end/screens/traceability/UC30_view_document/UC30_T02_document_has_content/test_UC30_T02_document_has_content.py index 958b3e72e..2f2ac565a 100644 --- a/tests/end2end/screens/traceability/UC30_view_document/UC30_T02_document_has_content/test_UC30_T02_document_has_content.py +++ b/tests/end2end/screens/traceability/UC30_view_document/UC30_T02_document_has_content/test_UC30_T02_document_has_content.py @@ -1,5 +1,4 @@ -from seleniumbase import BaseCase - +from tests.end2end.e2e_case import E2ECase from tests.end2end.end2end_test_setup import End2EndTestSetup from tests.end2end.helpers.components.viewtype_selector import ViewType_Selector from tests.end2end.helpers.screens.project_index.screen_project_index import ( @@ -8,7 +7,7 @@ from tests.end2end.server import SDocTestServer -class Test_UC30_T02_document_has_content(BaseCase): +class Test(E2ECase): def test(self): test_setup = End2EndTestSetup(path_to_test_file=__file__)