Skip to content

Commit 4143a8f

Browse files
committed
feat: Fix widget height in anywidget mode
1 parent 798af4a commit 4143a8f

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

bigframes/display/table_widget.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ body[data-theme='dark'] .bigframes-widget.bigframes-widget {
8181
.bigframes-widget .table-container {
8282
background-color: var(--bf-bg);
8383
margin: 0;
84-
max-height: 620px;
84+
height: 400px;
8585
overflow: auto;
8686
padding: 0;
8787
}

tests/js/table_widget.test.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,33 @@ describe('TableWidget', () => {
340340
* Tests that the widget correctly renders HTML with truncated columns (ellipsis)
341341
* and ensures that the ellipsis column is not treated as a sortable column.
342342
*/
343+
it('should have a fixed height for the table container', () => {
344+
// Mock the initial state
345+
model.get.mockImplementation((property) => {
346+
if (property === 'table_html') {
347+
return '<table>...</table>';
348+
}
349+
return null;
350+
});
351+
352+
// Load the CSS
353+
const fs = require('fs');
354+
const path = require('path');
355+
const css = fs.readFileSync(
356+
path.resolve(__dirname, '../../bigframes/display/table_widget.css'),
357+
'utf8',
358+
);
359+
const style = document.createElement('style');
360+
style.textContent = css;
361+
document.head.appendChild(style);
362+
363+
render({ model, el });
364+
365+
const tableContainer = el.querySelector('.table-container');
366+
const styles = window.getComputedStyle(tableContainer);
367+
expect(styles.height).toBe('400px');
368+
});
369+
343370
it('should render truncated columns with ellipsis and not make ellipsis sortable', () => {
344371
// Mock HTML with truncated columns
345372
// Use the structure produced by the python backend

0 commit comments

Comments
 (0)