From b3bfaeafcae89149bb343f65670f804eac22626e Mon Sep 17 00:00:00 2001 From: ilya-asiyuk-epam Date: Mon, 5 Feb 2024 14:03:19 +0400 Subject: [PATCH] #4014 - Macro: Monomers (attachment points) cannot be connected by a bond in Firefox browser --- .../R-group-tool/r-group-fragment-tool.spec.ts | 16 +++++++++------- .../src/application/editor/tools/Bond.ts | 4 ++-- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/ketcher-autotests/tests/Structure-Creating-&-Editing/Actions-With-Structures/R-group-tool/r-group-fragment-tool.spec.ts b/ketcher-autotests/tests/Structure-Creating-&-Editing/Actions-With-Structures/R-group-tool/r-group-fragment-tool.spec.ts index c724c73d3f..2db2b9c013 100644 --- a/ketcher-autotests/tests/Structure-Creating-&-Editing/Actions-With-Structures/R-group-tool/r-group-fragment-tool.spec.ts +++ b/ketcher-autotests/tests/Structure-Creating-&-Editing/Actions-With-Structures/R-group-tool/r-group-fragment-tool.spec.ts @@ -38,6 +38,12 @@ async function openRGroupModalForTopAtom(page: Page) { return { x, y }; } +async function selectRGroupFragmentTool(page: Page) { + await page.getByTestId('rgroup-attpoints-in-toolbar').first().click(); + await page.getByTestId('rgroup-attpoints').first().click(); + await page.getByTestId('rgroup-fragment').click(); +} + const rGroupFromFile = 'R8'; const atomIndex = 3; async function selectRGroups(page: Page, rGroups: string[]) { @@ -144,15 +150,11 @@ test.describe('Open Ketcher', () => { await selectDropdownTool(page, 'rgroup-label', 'rgroup-attpoints'); await clickOnAtom(page, 'C', atomIndex); await page.getByLabel(AttachmentPoint.PRIMARY).check(); - await clickModalButton(page, 'Apply'); - await selectNestedTool( - page, - RgroupTool.R_GROUP_FRAGMENT, - RgroupTool.ATTACHMENT_POINTS, - ); + await page.getByTestId('OK').click(); + await selectRGroupFragmentTool(page); await clickOnAtom(page, 'C', atomIndex); await page.getByText(rGroupFromFile).click(); - await clickModalButton(page, 'Apply'); + await page.getByTestId('OK').click(); }); test('Remove R-Group member from R-Group', async ({ page }) => { diff --git a/packages/ketcher-core/src/application/editor/tools/Bond.ts b/packages/ketcher-core/src/application/editor/tools/Bond.ts index 398cbf6bde..e8e29d42d1 100644 --- a/packages/ketcher-core/src/application/editor/tools/Bond.ts +++ b/packages/ketcher-core/src/application/editor/tools/Bond.ts @@ -214,7 +214,7 @@ class PolymerBond implements BaseTool { } public mouseUpAttachmentPoint(event) { - const renderer = event.toElement.__data__; + const renderer = event.target.__data__; const isFirstMonomerHovered = renderer === this.bondRenderer?.polymerBond?.firstMonomer?.renderer; @@ -309,7 +309,7 @@ class PolymerBond implements BaseTool { } public mouseUpMonomer(event) { - const renderer = event.toElement.__data__; + const renderer = event.target.__data__; const isFirstMonomerHovered = renderer === this.bondRenderer?.polymerBond?.firstMonomer?.renderer;