Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#6112 - System opens "intellisence"-like dropdown control in unnecessary case #6158

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
/* eslint-disable no-magic-numbers */
import { test, expect } from '@playwright/test';
import {
DELAY_IN_SECONDS,
clickInTheMiddleOfTheScreen,
clickOnAtom,
clickOnCanvas,
delay,
drawBenzeneRing,
moveOnAtom,
resetCurrentTool,
selectAllStructuresOnCanvas,
selectRectangleSelectionTool,
takeEditorScreenshot,
waitForPageInit,
} from '@utils';
Expand Down Expand Up @@ -182,9 +183,9 @@ test.describe('Lookup Abbreviations tests', () => {
await page.getByRole('button', { name: 'Benzene (T)' }).click();
await clickInTheMiddleOfTheScreen(page);
const atomC = 0;
await moveOnAtom(page, 'C', atomC);
await page.keyboard.type('mer');
await page.keyboard.press('Enter');
await clickOnAtom(page, 'C', atomC);
await takeEditorScreenshot(page);
});

Expand All @@ -196,25 +197,11 @@ test.describe('Lookup Abbreviations tests', () => {
await page.getByRole('button', { name: 'Benzene (T)' }).click();
await clickInTheMiddleOfTheScreen(page);
const atomC = 0;
await moveOnAtom(page, 'C', atomC);
await page.keyboard.type('bn');
await page.keyboard.press('Enter');
await takeEditorScreenshot(page);
});

test('atom state restores after typing additional letters', async ({
page,
}) => {
// EPMLSOPKET-16928
// will be added with https://github.com/epam/ketcher/issues/2789
await drawBenzeneRing(page);
const atomC = 0;
await resetCurrentTool(page);
await moveOnAtom(page, 'C', atomC);
await page.keyboard.type('n');
// 'N' should be placed on hovered atom
await page.keyboard.type('ickel');
// state of hovered atom should be restored
await clickOnAtom(page, 'C', atomC);
await selectRectangleSelectionTool(page);
await clickOnCanvas(page, 100, 100);
await takeEditorScreenshot(page);
});
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions packages/ketcher-react/src/script/ui/state/hotkeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ function keyHandle(dispatch, getState, hotKeys, event) {

let group: any = null;

if (key && key.length === 1) {
const hoveredItem = getHoveredItem(render.ctab);

if (key && key.length === 1 && !hoveredItem) {
const currentlyPressedKeys = selectAbbreviationLookupValue(state);
const isShortcutKey = shortcutKeys.includes(key?.toLowerCase());
const isTheSameKey = key === currentlyPressedKeys;
Expand Down Expand Up @@ -142,7 +144,6 @@ function keyHandle(dispatch, getState, hotKeys, event) {
bonds: actions['bond-props'].action,
};

const hoveredItem = getHoveredItem(render.ctab);
if (!hoveredItem) {
return;
}
Expand Down
Loading