Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: prevent grid with all rows visible from shrinking (#8535) (CP: 24.6) #8537

Merged
merged 1 commit into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/grid/src/vaadin-grid-styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export const gridStyles = css`
:host([all-rows-visible]) {
height: auto;
align-self: flex-start;
flex-shrink: 0;
flex-grow: 0;
width: 100%;
}
Expand Down
20 changes: 15 additions & 5 deletions packages/grid/test/min-height.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe('min-height', () => {
});

describe('without header or footer', () => {
it('should should have min-height of one row', () => {
it('should have min-height of one row', () => {
verifyMinHeight();
});
});
Expand All @@ -51,7 +51,7 @@ describe('min-height', () => {
await nextResize(grid);
});

it('should should have min-height of header and one row', () => {
it('should have min-height of header and one row', () => {
verifyMinHeight(true, false);
});
});
Expand All @@ -65,7 +65,7 @@ describe('min-height', () => {
await nextResize(grid);
});

it('should should have min-height of footer and one row', () => {
it('should have min-height of footer and one row', () => {
verifyMinHeight(false, true);
});
});
Expand All @@ -80,7 +80,7 @@ describe('min-height', () => {
await nextResize(grid);
});

it('should should have min-height of header, footer and one row', () => {
it('should have min-height of header, footer and one row', () => {
verifyMinHeight(true, true);
});
});
Expand All @@ -94,7 +94,7 @@ describe('min-height', () => {
await nextResize(grid);
});

it('should should have min-height of one row', () => {
it('should have min-height of one row', () => {
verifyMinHeight();
});
});
Expand All @@ -115,4 +115,14 @@ describe('min-height', () => {
expect(height).to.equal(200);
});
});

describe('with all rows visible', () => {
beforeEach(() => {
grid.allRowsVisible = true;
});

it('should have min-height of one row', () => {
verifyMinHeight();
});
});
});
10 changes: 10 additions & 0 deletions packages/grid/test/resizing.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,16 @@ describe('resizing', () => {
component.style.flexDirection = 'row';
expect(grid.getBoundingClientRect().width).to.be.above(780);
});

it('should not shrink vertically inside a column flexbox with another child', () => {
grid.size = 5;

component.style.height = '500px';
grid.after(fixtureSync('<div style="height: 100%"></div>'));

expect(grid._firstVisibleIndex).to.equal(0);
expect(grid._lastVisibleIndex).to.equal(grid.size - 1);
});
});
});

Expand Down