forked from jupyterlab/jupyterlab
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add output prompt overlay for toggling scroll mode (jupyterlab#14072)
* Implement output scroll overlay * Add snapshots for scrolling outputs * Update Playwright Snapshots * Update Playwright Snapshots * Add missing await * Revert snapshots incorrectly updated by bot --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
dd38238
commit 772684e
Showing
9 changed files
with
237 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"id": "4315a064-fc29-4183-81b6-fdea37c02102", | ||
"metadata": { | ||
"tags": [] | ||
}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"line\n", | ||
"line\n", | ||
"line\n", | ||
"line\n", | ||
"line\n", | ||
"line\n", | ||
"line\n", | ||
"line\n", | ||
"line\n", | ||
"line\n", | ||
"line\n", | ||
"line\n", | ||
"line\n", | ||
"line\n", | ||
"line\n", | ||
"line\n", | ||
"line\n", | ||
"line\n", | ||
"line\n", | ||
"line\n", | ||
"\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"print('line\\n' * 20)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"id": "1782c124-9e18-4864-b457-acb7a4186105", | ||
"metadata": { | ||
"tags": [] | ||
}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"multiple\n" | ||
] | ||
}, | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"'outputs'" | ||
] | ||
}, | ||
"execution_count": 2, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"print('multiple')\n", | ||
"'outputs'" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3 (ipykernel)", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.8.6" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
// Copyright (c) Jupyter Development Team. | ||
// Distributed under the terms of the Modified BSD License. | ||
|
||
import { test } from '@jupyterlab/galata'; | ||
import { expect } from '@playwright/test'; | ||
import * as path from 'path'; | ||
|
||
const fileName = 'output_scrolling.ipynb'; | ||
|
||
const cellSelector = '[role="main"] >> .jp-NotebookPanel >> .jp-Cell'; | ||
|
||
test.describe('Output Scrolling', () => { | ||
test.beforeEach(async ({ page, tmpPath }) => { | ||
await page.contents.uploadFile( | ||
path.resolve(__dirname, `./notebooks/${fileName}`), | ||
`${tmpPath}/${fileName}` | ||
); | ||
|
||
await page.notebook.openByPath(`${tmpPath}/${fileName}`); | ||
await page.notebook.activate(fileName); | ||
}); | ||
|
||
test.afterEach(async ({ page, tmpPath }) => { | ||
await page.contents.deleteDirectory(tmpPath); | ||
}); | ||
|
||
test('Scrolling mode', async ({ page }) => { | ||
await page.evaluate(() => { | ||
return window.jupyterapp.commands.execute( | ||
'notebook:enable-output-scrolling' | ||
); | ||
}); | ||
await page.notebook.selectCells(0); | ||
await expect(page.locator(`${cellSelector} >> nth=0`)).toHaveClass( | ||
/jp-mod-outputsScrolled/ | ||
); | ||
|
||
const cell = await page.notebook.getCell(0); | ||
|
||
expect(await (await cell.$('.jp-OutputArea')).screenshot()).toMatchSnapshot( | ||
'cell-output-area-scrolling-mode.png' | ||
); | ||
|
||
await page.evaluate(() => { | ||
return window.jupyterapp.commands.execute( | ||
'notebook:disable-output-scrolling' | ||
); | ||
}); | ||
await expect(page.locator(`${cellSelector} >> nth=0`)).not.toHaveClass( | ||
/jp-mod-outputsScrolled/ | ||
); | ||
}); | ||
|
||
test('Switching with prompt overlay', async ({ page }) => { | ||
await page | ||
.locator(`${cellSelector} >> nth=1 >> .jp-OutputArea-promptOverlay`) | ||
.hover(); | ||
const cell = await page.notebook.getCell(1); | ||
expect(await cell.screenshot()).toMatchSnapshot( | ||
'prompt-overlay-hover-normal.png' | ||
); | ||
await page.click( | ||
`${cellSelector} >> nth=1 >> .jp-OutputArea-promptOverlay` | ||
); | ||
await expect(page.locator(`${cellSelector} >> nth=1`)).toHaveClass( | ||
/jp-mod-outputsScrolled/ | ||
); | ||
expect(await cell.screenshot()).toMatchSnapshot( | ||
'prompt-overlay-hover-scroll.png' | ||
); | ||
await page.click( | ||
`${cellSelector} >> nth=1 >> .jp-OutputArea-promptOverlay` | ||
); | ||
await expect(page.locator(`${cellSelector} >> nth=1`)).not.toHaveClass( | ||
/jp-mod-outputsScrolled/ | ||
); | ||
}); | ||
}); |
Binary file added
BIN
+1.84 KB
...crolling.test.ts-snapshots/cell-output-area-scrolling-mode-jupyterlab-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.08 KB
...ut-scrolling.test.ts-snapshots/prompt-overlay-hover-normal-jupyterlab-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.87 KB
...ut-scrolling.test.ts-snapshots/prompt-overlay-hover-scroll-jupyterlab-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters