Skip to content
Merged
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
40 changes: 40 additions & 0 deletions packages/grid/test/column.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,46 @@
});
});

describe('cell content attach and detach', () => {
['header', 'body', 'footer'].forEach((sectionName) => {
let content;

beforeEach(() => {
switch (sectionName) {
case 'header':
content = getHeaderCellContent(grid, 1, 0);
break;
case 'footer':
content = getContainerCellContent(grid.$.footer, 0, 0);
break;
default:
content = getBodyCellContent(grid, 0, 0);
}
});

it(`should remove ${sectionName} cell content from the grid when column is removed`, async () => {

Check failure on line 523 in packages/grid/test/column.test.js

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Add at least one assertion to this test case.

See more on https://sonarcloud.io/project/issues?id=vaadin_web-components&issues=AZ9wPrVu9cJglEUvM0VH&open=AZ9wPrVu9cJglEUvM0VH&pullRequest=12181
column.remove();
await nextFrame();

expect(content.parentElement).to.be.null;
});
});

it('should render cell content when column is added back', async () => {
const group = column.parentElement;
column.remove();
await nextFrame();

group.insertBefore(column, group.firstElementChild);
await nextFrame();
flushGrid(grid);

expect(getHeaderCellContent(grid, 1, 0).textContent).to.equal('header1');
expect(getContainerCellContent(grid.$.footer, 0, 0).textContent).to.equal('footer1');
expect(getBodyCellContent(grid, 0, 0).textContent).to.equal('cell');
});
});

it('should not throw an exception when size is changed after removing column', () => {
expect(grid.size).to.equal(10);
expect(column.isConnected).to.be.true;
Expand Down
Loading