Skip to content

Commit

Permalink
Switch to defaultValue and add a test for typing (jupyterlab#14085)
Browse files Browse the repository at this point in the history
  • Loading branch information
krassowski authored Feb 27, 2023
1 parent f7718db commit 115369f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
12 changes: 12 additions & 0 deletions galata/test/jupyterlab/notebook-search.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,18 @@ test.describe('Notebook Search', () => {
expect(await nbPanel.screenshot()).toMatchSnapshot('search.png');
});

test('Typing in search box', async ({ page }) => {
// Check against React being too eager with controling state of input box
await page.keyboard.press('Control+f');

await page.fill('[placeholder="Find"]', '14');
await page.press('[placeholder="Find"]', 'ArrowLeft');
await page.type('[placeholder="Find"]', '2');
await page.type('[placeholder="Find"]', '3');

await expect(page.locator('[placeholder="Find"]')).toHaveValue('1234');
});

test('RegExp parsing failure', async ({ page }) => {
await page.keyboard.press('Control+f');

Expand Down
5 changes: 2 additions & 3 deletions packages/documentsearch/src/searchview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,8 @@ function SearchInput(props: ISearchInputProps): JSX.Element {
tabIndex={0}
ref={props.inputRef}
title={props.title}
>
{props.value}
</textarea>
defaultValue={props.value}
></textarea>
);
}

Expand Down

0 comments on commit 115369f

Please sign in to comment.