Skip to content

Commit

Permalink
fix: regenerate cell class names after column tree update (#3033) (#3037
Browse files Browse the repository at this point in the history
)
  • Loading branch information
vaadin-bot committed Nov 15, 2021
1 parent 72ef486 commit aad2a61
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/grid/src/vaadin-grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -864,6 +864,7 @@ class Grid extends ElementMixin(
this._a11yUpdateHeaderRows();
this._a11yUpdateFooterRows();
this.__updateFooterPositioning();
this.generateCellClassNames();
}

__updateFooterPositioning() {
Expand Down
11 changes: 11 additions & 0 deletions packages/grid/test/class-name-generator.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,15 @@ describe('class name generator', () => {
expect(() => (grid.cellClassNameGenerator = () => ' foo bar ')).not.to.throw(Error);
assertClassList(firstCell, ['foo', 'bar']);
});

it('should have the right class names after toggling column visibility', async () => {
grid.cellClassNameGenerator = (_column, { index }) => (index % 2 === 0 ? 'even' : 'odd');
const column = grid.querySelector('vaadin-grid-column');
column.hidden = true;
await nextFrame();
column.hidden = false;
await nextFrame();
assertClassList(getContainerCell(grid.$.items, 1, 0), ['odd']);
assertClassList(getContainerCell(grid.$.items, 1, 1), ['odd']);
});
});

0 comments on commit aad2a61

Please sign in to comment.