diff --git a/ketcher-autotests/tests/Structure-Creating-&-Editing/Actions-With-Structures/S-Group-Tool/Data-S-Group-Tool/s-group-click-atom-bond.spec.ts b/ketcher-autotests/tests/Structure-Creating-&-Editing/Actions-With-Structures/S-Group-Tool/Data-S-Group-Tool/s-group-click-atom-bond.spec.ts index 554d391d45..e514800ca0 100644 --- a/ketcher-autotests/tests/Structure-Creating-&-Editing/Actions-With-Structures/S-Group-Tool/Data-S-Group-Tool/s-group-click-atom-bond.spec.ts +++ b/ketcher-autotests/tests/Structure-Creating-&-Editing/Actions-With-Structures/S-Group-Tool/Data-S-Group-Tool/s-group-click-atom-bond.spec.ts @@ -22,8 +22,8 @@ test.describe('S-Group Properties', () => { test('Checking S-Group drop-down types', async ({ page }) => { /* Test case: EPMLSOPKET-1502 - Description: Checking S-Group drop-down types 'Type' drop-down list with Data, - Multiple group, SRU polymer and Superatom items. Data item is selected by default; + Description: Checking S-Group drop-down types 'Type' drop-down list with Data, + Multiple group, SRU polymer, Superatom and Query Component items. Data item is selected by default; */ await selectRingButton(RingButton.Benzene, page); await clickInTheMiddleOfTheScreen(page); @@ -77,4 +77,18 @@ test.describe('S-Group Properties', () => { await takeEditorScreenshot(page); await page.getByRole('button', { name: 'Apply' }).click(); }); + + test('A query component is created', async ({ page }) => { + await selectRingButton(RingButton.Benzene, page); + await clickInTheMiddleOfTheScreen(page); + + await selectLeftPanelButton(LeftPanelButton.S_Group, page); + const { x, y } = await getCoordinatesTopAtomOfBenzeneRing(page); + await page.mouse.click(x, y); + await page.getByRole('button', { name: 'Data' }).click(); + await page.getByRole('option', { name: 'Query component' }).click(); + + await takeEditorScreenshot(page); + await page.getByRole('button', { name: 'Apply' }).click(); + }); }); diff --git a/ketcher-autotests/tests/Structure-Creating-&-Editing/Actions-With-Structures/S-Group-Tool/Data-S-Group-Tool/s-group-click-atom-bond.spec.ts-snapshots/S-Group-Properties-A-query-component-is-created-1-chromium-linux.png b/ketcher-autotests/tests/Structure-Creating-&-Editing/Actions-With-Structures/S-Group-Tool/Data-S-Group-Tool/s-group-click-atom-bond.spec.ts-snapshots/S-Group-Properties-A-query-component-is-created-1-chromium-linux.png new file mode 100644 index 0000000000..cd8e1c8e4f Binary files /dev/null and b/ketcher-autotests/tests/Structure-Creating-&-Editing/Actions-With-Structures/S-Group-Tool/Data-S-Group-Tool/s-group-click-atom-bond.spec.ts-snapshots/S-Group-Properties-A-query-component-is-created-1-chromium-linux.png differ diff --git a/ketcher-autotests/tests/Structure-Creating-&-Editing/Actions-With-Structures/S-Group-Tool/Data-S-Group-Tool/s-group-click-atom-bond.spec.ts-snapshots/S-Group-Properties-A-query-component-is-created-2-chromium-linux.png b/ketcher-autotests/tests/Structure-Creating-&-Editing/Actions-With-Structures/S-Group-Tool/Data-S-Group-Tool/s-group-click-atom-bond.spec.ts-snapshots/S-Group-Properties-A-query-component-is-created-2-chromium-linux.png new file mode 100644 index 0000000000..f99aa55c85 Binary files /dev/null and b/ketcher-autotests/tests/Structure-Creating-&-Editing/Actions-With-Structures/S-Group-Tool/Data-S-Group-Tool/s-group-click-atom-bond.spec.ts-snapshots/S-Group-Properties-A-query-component-is-created-2-chromium-linux.png differ diff --git a/ketcher-autotests/tests/Structure-Creating-&-Editing/Actions-With-Structures/S-Group-Tool/Data-S-Group-Tool/s-group-click-atom-bond.spec.ts-snapshots/S-Group-Properties-Checking-S-Group-drop-down-types-1-chromium-linux.png b/ketcher-autotests/tests/Structure-Creating-&-Editing/Actions-With-Structures/S-Group-Tool/Data-S-Group-Tool/s-group-click-atom-bond.spec.ts-snapshots/S-Group-Properties-Checking-S-Group-drop-down-types-1-chromium-linux.png index 124bf8ebe2..3dcf62dc4e 100644 Binary files a/ketcher-autotests/tests/Structure-Creating-&-Editing/Actions-With-Structures/S-Group-Tool/Data-S-Group-Tool/s-group-click-atom-bond.spec.ts-snapshots/S-Group-Properties-Checking-S-Group-drop-down-types-1-chromium-linux.png and b/ketcher-autotests/tests/Structure-Creating-&-Editing/Actions-With-Structures/S-Group-Tool/Data-S-Group-Tool/s-group-click-atom-bond.spec.ts-snapshots/S-Group-Properties-Checking-S-Group-drop-down-types-1-chromium-linux.png differ diff --git a/packages/ketcher-core/src/application/editor/actions/sgroup.ts b/packages/ketcher-core/src/application/editor/actions/sgroup.ts index c6791797bd..61a00956b4 100644 --- a/packages/ketcher-core/src/application/editor/actions/sgroup.ts +++ b/packages/ketcher-core/src/application/editor/actions/sgroup.ts @@ -273,7 +273,7 @@ export function fromSgroupAction( } if (SGroup.isQuerySGroup(newSg)) { - return fromQueryGroupAction( + return fromQuerySGroupAction( restruct, newSg, newSourceAtoms, @@ -309,7 +309,7 @@ function fromAtomAction(restruct, newSg, sourceAtoms) { ); } -function fromQueryGroupAction(restruct, newSg, sourceAtoms, targetAtoms) { +function fromQuerySGroupAction(restruct, newSg, sourceAtoms, targetAtoms) { const selection: { atoms: number[]; bonds: number[]; diff --git a/packages/ketcher-react/src/script/editor/tool/sgroup.ts b/packages/ketcher-react/src/script/editor/tool/sgroup.ts index 791db27edf..20af04a62a 100644 --- a/packages/ketcher-react/src/script/editor/tool/sgroup.ts +++ b/packages/ketcher-react/src/script/editor/tool/sgroup.ts @@ -531,7 +531,7 @@ class SGroupTool implements Tool { return; } const result = isQuerySGroup - ? createQueryComponent(id, editor, newSg, selection, sg) + ? createQuerySGroup(id, editor, newSg, selection, sg) : fromContextType(id, editor, newSg, selection); result && editor.update(result.action); @@ -544,7 +544,7 @@ class SGroupTool implements Tool { } } -function createQueryComponent( +function createQuerySGroup( id: number | null, editor: Editor, newSg,