diff --git a/ketcher-autotests/tests/utils/clicks/index.ts b/ketcher-autotests/tests/utils/clicks/index.ts index 36d0e01565..ec59a6887b 100644 --- a/ketcher-autotests/tests/utils/clicks/index.ts +++ b/ketcher-autotests/tests/utils/clicks/index.ts @@ -194,6 +194,10 @@ export async function openDropdown(page: Page, dropdownElementId: DropdownIds) { const button = page.getByTestId(dropdownElementId); await button.isVisible(); await button.click({ delay: 200, clickCount: 2 }); + const dropdown = await page.locator('.default-multitool-dropdown'); + if (!(await dropdown.isVisible({ timeout: 200 }))) { + await button.click(); + } } export async function selectDropdownTool( diff --git a/packages/ketcher-core/src/application/editor/Editor.ts b/packages/ketcher-core/src/application/editor/Editor.ts index 627fbd8408..b84c073bb0 100644 --- a/packages/ketcher-core/src/application/editor/Editor.ts +++ b/packages/ketcher-core/src/application/editor/Editor.ts @@ -326,14 +326,7 @@ export class CoreEditor { initialFirstMonomerAttachmentPoint?: AttachmentPointName; initialSecondMonomerAttachmentPoint?: AttachmentPointName; }) { - if ( - payload.isReconnection && - payload.polymerBond && - (payload.firstSelectedAttachmentPoint !== - payload.initialFirstMonomerAttachmentPoint || - payload.secondSelectedAttachmentPoint !== - payload.initialSecondMonomerAttachmentPoint) - ) { + if (payload.isReconnection && payload.polymerBond) { const command = new Command(); const history = new EditorHistory(this); diff --git a/packages/ketcher-macromolecules/src/components/modal/monomerConnection/MonomerConnections.tsx b/packages/ketcher-macromolecules/src/components/modal/monomerConnection/MonomerConnections.tsx index 14992aa2f0..896dfb131a 100644 --- a/packages/ketcher-macromolecules/src/components/modal/monomerConnection/MonomerConnections.tsx +++ b/packages/ketcher-macromolecules/src/components/modal/monomerConnection/MonomerConnections.tsx @@ -118,6 +118,17 @@ const MonomerConnection = ({ throw new Error('Attachment points cannot be falsy'); } + if ( + firstSelectedAttachmentPoint === + initialFirstMonomerAttachmentPointRef.current && + secondSelectedAttachmentPoint === + initialSecondMonomerAttachmentPointRef.current + ) { + cancelBondCreationAndClose(); + + return; + } + editor.events.createBondViaModal.dispatch({ firstMonomer, secondMonomer,