Skip to content

Commit

Permalink
fix: remove renderer before stamping template (#199) (#200)
Browse files Browse the repository at this point in the history
  • Loading branch information
yuriy-fix committed Jul 14, 2023
1 parent f178ebf commit c1eb982
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/vaadin-grid-pro-edit-column.html
Expand Up @@ -321,8 +321,8 @@
/** @private */
_removeEditor(cell, model) {
if (cell.__savedTemplate) {
this._stampTemplateToCell(cell, cell.__savedTemplate, model);
cell._renderer = undefined;
this._stampTemplateToCell(cell, cell.__savedTemplate, model);
cell.__savedTemplate = undefined;
} else if (cell.__savedRenderer) {
this._stampRendererToCell(cell, cell.__savedRenderer, model);
Expand Down
13 changes: 13 additions & 0 deletions test/edit-column-template.html
Expand Up @@ -140,6 +140,19 @@
expect(getCellEditor(cell)).to.be.not.ok;
expect(cell._content.textContent).to.equal(old);
});

it('should restore template and remove editor when editing stopped after selection', () => {
const old = cell._content.textContent;
enter(cell);
grid.selectItem(grid.items[0]);
// Emulating stop editing with focusout
getCellEditor(cell).dispatchEvent(new CustomEvent('focusout', {bubbles: true, composed: true}));
grid._flushStopEdit();
expect(cell._renderer).to.be.not.ok;
expect(cell._template).to.equal(column._bodyTemplate);
expect(getCellEditor(cell)).to.be.not.ok;
expect(cell._content.textContent).to.equal(old);
});
});

describe('custom edit mode template', () => {
Expand Down

0 comments on commit c1eb982

Please sign in to comment.