diff --git a/packages/component-base/src/slot-controller.js b/packages/component-base/src/slot-controller.js index eb9d25494b..258b23830d 100644 --- a/packages/component-base/src/slot-controller.js +++ b/packages/component-base/src/slot-controller.js @@ -111,12 +111,12 @@ export class SlotController extends EventTarget { if (slotName !== '') { node.setAttribute('slot', slotName); } - this.node = node; this.defaultNode = node; } } if (node) { + this.node = node; host.appendChild(node); } diff --git a/packages/field-base/test/field-mixin.test.js b/packages/field-base/test/field-mixin.test.js index ece07803b4..041ec9d8fe 100644 --- a/packages/field-base/test/field-mixin.test.js +++ b/packages/field-base/test/field-mixin.test.js @@ -592,6 +592,17 @@ const runTests = (defineHelper, baseMixin) => { expect(element._helperNode).to.equal(defaultHelper); }); + it('should restore the default helper when restoring helperText immediately', async () => { + element.helperText = null; + element.appendChild(helper); + await nextRender(); + + element.removeChild(helper); + element.helperText = 'Updated helper'; + await nextRender(); + expect(element._helperNode.textContent).to.equal('Updated helper'); + }); + it('should keep has-helper attribute when the default helper is restored', async () => { element.appendChild(helper); await nextRender();