Skip to content

Commit

Permalink
#2982 – added tests for not showing abbreviation lookup for repetitiv…
Browse files Browse the repository at this point in the history
…e keystrokes
  • Loading branch information
Nitvex committed Aug 1, 2023
1 parent 85bdabf commit 8e59995
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { test } from '@playwright/test';
import { test, expect } from '@playwright/test';
import { clickInTheMiddleOfTheScreen, takeEditorScreenshot } from '@utils';

/*
Expand All @@ -21,4 +21,34 @@ test.describe('Lookup Abbreviations window', () => {
await page.bringToFront();
await takeEditorScreenshot(page);
});

test('is shown, when entering some text', async ({ page }) => {
await clickInTheMiddleOfTheScreen(page);
await page.keyboard.type('mek');
const abbreviationLookup = await page.getByTestId('AbbreviationLookup');
expect(await abbreviationLookup.isVisible()).toBe(true);
await takeEditorScreenshot(page);
});

test('is not shown, when pressing "1" multiple times to change bond type', async ({
page,
}) => {
await clickInTheMiddleOfTheScreen(page);
await page.keyboard.type('1');
await page.keyboard.type('1');
await page.keyboard.type('1');
const abbreviationLookup = await page.getByTestId('AbbreviationLookup');
expect(await abbreviationLookup.isVisible()).toBe(false);
});

test('is not shown, when pressing "t" multiple times to change template', async ({
page,
}) => {
await clickInTheMiddleOfTheScreen(page);
await page.keyboard.type('t');
await page.keyboard.type('t');
await page.keyboard.type('t');
const abbreviationLookup = await page.getByTestId('AbbreviationLookup');
expect(await abbreviationLookup.isVisible()).toBe(false);
});
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/ketcher-react/src/script/ui/state/hotkeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function removeNotRenderedStruct(actionTool, group, dispatch) {

let abbreviationLookupTimeoutId: number | undefined;
const ABBREVIATION_LOOKUP_TYPING_TIMEOUT = 1000;
const shortcutKeys = ['1', 't'];
const shortcutKeys = ['1', '2', '3', '4', 't'];

/* HotKeys */
function keyHandle(dispatch, getState, hotKeys, event) {
Expand Down

0 comments on commit 8e59995

Please sign in to comment.