Skip to content

Commit

Permalink
fix!: update vaadin-grid-selection-column to use autoWidth: true (#7232)
Browse files Browse the repository at this point in the history
  • Loading branch information
web-padawan authored Mar 19, 2024
1 parent 7254cc0 commit ab7926f
Show file tree
Hide file tree
Showing 20 changed files with 65 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/grid/src/vaadin-grid-selection-column-base-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ export const GridSelectionColumnBaseMixin = (superClass) =>
sync: true,
},

/**
* Override `autoWidth` to enable auto-width
*/
autoWidth: {
type: Boolean,
value: true,
},

/**
* Flex grow ratio for the cell widths. When set to 0, cell width is fixed.
* @attr {number} flex-grow
Expand Down
55 changes: 55 additions & 0 deletions packages/grid/test/visual/grid.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,61 @@ describe('grid', () => {
});
});

describe('selection', () => {
let selectionColumn;

describe('start', () => {
beforeEach(async () => {
element = fixtureSync(`
<vaadin-grid style="height: 250px; max-width: 260px">
<vaadin-grid-selection-column auto-select></vaadin-grid-selection-column>
<vaadin-grid-column path="name.first" header="First name"></vaadin-grid-column>
<vaadin-grid-column path="name.last" header="Last name"></vaadin-grid-column>
</vaadin-grid>
`);
element.items = users;
flushGrid(element);
await nextRender(element);
selectionColumn = element.querySelector('vaadin-grid-selection-column');
});

it('initial', async () => {
await visualDiff(element, `${dir}-selection-start-initial`);
});

it('frozen', async () => {
selectionColumn.frozen = true;
element.$.table.scrollLeft = element.__isRTL ? -20 : 20;
await visualDiff(element, `${dir}-selection-start-frozen`);
});
});

describe('end', () => {
beforeEach(async () => {
element = fixtureSync(`
<vaadin-grid style="height: 250px; max-width: 260px">
<vaadin-grid-column path="name.first" header="First name"></vaadin-grid-column>
<vaadin-grid-column path="name.last" header="Last name"></vaadin-grid-column>
<vaadin-grid-selection-column auto-select></vaadin-grid-selection-column>
</vaadin-grid>
`);
element.items = users;
flushGrid(element);
await nextRender(element);
selectionColumn = element.querySelector('vaadin-grid-selection-column');
});

it('initial', async () => {
await visualDiff(element, `${dir}-selection-end-initial`);
});

it('frozen', async () => {
selectionColumn.frozenToEnd = true;
await visualDiff(element, `${dir}-selection-end-frozen`);
});
});
});

describe('row focus', () => {
beforeEach(async () => {
element = fixtureSync(`
Expand Down
1 change: 1 addition & 0 deletions packages/grid/test/visual/lumo/grid.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { fixtureSync, nextRender } from '@vaadin/testing-helpers';
import { visualDiff } from '@web/test-runner-visual-regression';
import '../../../theme/lumo/vaadin-grid.js';
import '../../../theme/lumo/vaadin-grid-column-group.js';
import '../../../theme/lumo/vaadin-grid-selection-column.js';
import '../../../theme/lumo/vaadin-grid-sorter.js';
import '../../../theme/lumo/vaadin-grid-sort-column.js';
import '../../../theme/lumo/vaadin-grid-tree-column.js';
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions packages/grid/test/visual/material/grid.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import '../../../theme/material/vaadin-grid.js';
import '../../../theme/material/vaadin-grid-column-group.js';
import '../../../theme/material/vaadin-grid-selection-column.js';
import '../../../theme/material/vaadin-grid-sorter.js';
import '../../../theme/material/vaadin-grid-sort-column.js';
import '../../../theme/material/vaadin-grid-tree-column.js';
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ab7926f

Please sign in to comment.