Skip to content

Commit

Permalink
Backport PR #15322: Fix collapsed cells styling (#15327)
Browse files Browse the repository at this point in the history
Co-authored-by: Frédéric Collonval <fcollonval@users.noreply.github.com>
  • Loading branch information
meeseeksmachine and fcollonval committed Oct 29, 2023
1 parent 9cb7672 commit 46bb234
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 4 deletions.
34 changes: 34 additions & 0 deletions galata/test/jupyterlab/cells.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.

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

const fileName = 'simple_notebook.ipynb';

test.describe('Cells', () => {
test.beforeEach(async ({ page, request, tmpPath }) => {
const contents = galata.newContentsHelper(request);
await contents.uploadFile(
path.resolve(__dirname, `./notebooks/${fileName}`),
`${tmpPath}/${fileName}`
);
await contents.uploadFile(
path.resolve(__dirname, './notebooks/WidgetArch.png'),
`${tmpPath}/WidgetArch.png`
);

await page.notebook.openByPath(`${tmpPath}/${fileName}`);
await page.notebook.activate(fileName);
});

test('should collapse a cell', async ({ page }) => {
await page.notebook.run();

await page.locator('.jp-Cell-inputCollapser').nth(2).click();

expect(await page.locator('.jp-Cell').nth(2).screenshot()).toMatchSnapshot(
'collapsed-cell.png'
);
});
});
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 22 additions & 4 deletions packages/cells/style/placeholder.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@
|----------------------------------------------------------------------------*/

.jp-Placeholder {
display: table;
table-layout: fixed;
display: flex;
flex-direction: row;
width: 100%;
}

.jp-Placeholder-prompt {
display: table-cell;
flex: 0 0 var(--jp-cell-prompt-width);
box-sizing: border-box;
}

.jp-Placeholder-content {
display: table-cell;
flex: 1 1 auto;
padding: 4px 6px;
border: 1px solid transparent;
border-radius: 0;
Expand Down Expand Up @@ -61,3 +61,21 @@
border-color: var(--jp-cell-editor-border-color);
background: var(--jp-cell-editor-background);
}

/*-----------------------------------------------------------------------------
| Print
|----------------------------------------------------------------------------*/
@media print {
.jp-Placeholder {
display: table;
table-layout: fixed;
}

.jp-Placeholder-content {
display: table-cell;
}

.jp-Placeholder-prompt {
display: table-cell;
}
}

0 comments on commit 46bb234

Please sign in to comment.