Skip to content

Commit

Permalink
Backport PR jupyterlab#16343: Fix Shift + Tab contextual help inspe…
Browse files Browse the repository at this point in the history
…ctor tooltip regression
  • Loading branch information
krassowski authored and meeseeksmachine committed May 22, 2024
1 parent f242f98 commit 2a41b8a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
30 changes: 30 additions & 0 deletions galata/test/jupyterlab/inspector-tooltip.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.

import { expect, test } from '@jupyterlab/galata';

const fileName = 'notebook.ipynb';
const TOOLTIP_SELECTOR = '.jp-Tooltip';

test.describe('Inspector (contextual help) tooltip', () => {
test.beforeEach(async ({ page }) => {
await page.notebook.createNew(fileName);
});

test('Should show up on Shift + Tab', async ({ page }) => {
await page.notebook.setCell(0, 'code', 'int');
await page.notebook.enterCellEditingMode(0);
// Ensure the cursor is at the end of the cell, after "int"
await page.keyboard.press('End');
// Ensure kernel is ready
await page.locator('text=| Idle').waitFor();
const tooltip = page.locator(TOOLTIP_SELECTOR);
// There should be no tooltip yet
await expect(tooltip).toHaveCount(0);
// Invoke the tooltip
await page.keyboard.press('Shift+Tab');
// There should be a tooltip now
await expect(tooltip).toHaveCount(1);
await expect(tooltip).toContainText('int');
});
});
2 changes: 1 addition & 1 deletion packages/codemirror/src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export namespace StateCommands {
dispatch: (transaction: Transaction) => void;
}): boolean {
if (target.dom.closest(TOOLTIP_OPENER_SELECTOR)) {
return true;
return false;
}
return indentLess(target);
}
Expand Down

0 comments on commit 2a41b8a

Please sign in to comment.