Skip to content

Commit 408e353

Browse files
authored
test: improve flaky grid-pro custom editor integration test (#10051)
1 parent b4031cf commit 408e353

File tree

1 file changed

+27
-6
lines changed

1 file changed

+27
-6
lines changed

test/integration/grid-pro-custom-editor.test.js

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,40 @@ import { dblclick, flushGrid, getContainerCell } from '@vaadin/grid-pro/test/hel
1515
describe('grid-pro custom editor', () => {
1616
let grid, cell;
1717

18-
function createGrid(path, autoOpen = false) {
18+
function createGrid(path) {
1919
grid = fixtureSync(`
2020
<vaadin-grid-pro>
2121
<vaadin-grid-pro-edit-column path="${path}" editor-type="custom"></vaadin-grid-pro-edit-column>
2222
</vaadin-gri-pro>
2323
`);
2424

25+
// 1. Ensure grid cells have some height.
26+
// 2. Allow date-picker backdrop clicks.
27+
fixtureSync(`
28+
<style>
29+
vaadin-grid-pro::part(cell) {
30+
min-height: 36px;
31+
}
32+
33+
vaadin-date-picker-overlay[fullscreen] {
34+
inset: 0 !important;
35+
justify-content: flex-end !important;
36+
}
37+
38+
vaadin-date-picker-overlay[fullscreen]::part(overlay) {
39+
width: 100%;
40+
height: 70vh;
41+
max-height: 70vh;
42+
}
43+
</style>
44+
`);
45+
2546
const column = grid.querySelector(`[path="${path}"]`);
2647
switch (path) {
2748
case 'date':
28-
column.editModeRenderer = (root, _, model) => {
49+
column.editModeRenderer = (root, column, model) => {
2950
root.innerHTML = `
30-
<vaadin-date-picker value="${model.item.date}" ${!autoOpen ? 'auto-open-disabled' : ''}></vaadin-date-picker>
51+
<vaadin-date-picker value="${model.item.date}" ${!column.autoOpen ? 'auto-open-disabled' : ''}></vaadin-date-picker>
3152
`;
3253
};
3354
break;
@@ -175,8 +196,8 @@ describe('grid-pro custom editor', () => {
175196

176197
beforeEach(async () => {
177198
await setViewport({ width: 420, height: 1020 });
178-
grid = createGrid('date', true);
179-
await nextRender();
199+
// Do not set auto-open-disabled on the date-picker
200+
grid.querySelector('vaadin-grid-pro-edit-column').autoOpen = true;
180201
cell = getContainerCell(grid.$.items, 0, 0);
181202
await sendMouse({ type: 'click', position: [10, 10] });
182203
});
@@ -215,7 +236,7 @@ describe('grid-pro custom editor', () => {
215236
const datePicker = cell._content.querySelector('vaadin-date-picker');
216237
await untilOverlayRendered(datePicker);
217238

218-
sendMouse({ type: 'click', position: [10, 10] });
239+
await sendMouse({ type: 'click', position: [10, 10] });
219240
await nextRender();
220241
expect(cell._content.querySelector('vaadin-date-picker')).to.not.be.ok;
221242
expect(previousContent).to.be.equal(cell._content.textContent);

0 commit comments

Comments
 (0)