Skip to content

Commit 8756734

Browse files
authored
fix: restore default node correctly when using helperText (#7449)
1 parent 66675cc commit 8756734

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

packages/component-base/src/slot-controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,12 @@ export class SlotController extends EventTarget {
111111
if (slotName !== '') {
112112
node.setAttribute('slot', slotName);
113113
}
114-
this.node = node;
115114
this.defaultNode = node;
116115
}
117116
}
118117

119118
if (node) {
119+
this.node = node;
120120
host.appendChild(node);
121121
}
122122

packages/field-base/test/field-mixin.test.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,17 @@ const runTests = (defineHelper, baseMixin) => {
592592
expect(element._helperNode).to.equal(defaultHelper);
593593
});
594594

595+
it('should restore the default helper when restoring helperText immediately', async () => {
596+
element.helperText = null;
597+
element.appendChild(helper);
598+
await nextRender();
599+
600+
element.removeChild(helper);
601+
element.helperText = 'Updated helper';
602+
await nextRender();
603+
expect(element._helperNode.textContent).to.equal('Updated helper');
604+
});
605+
595606
it('should keep has-helper attribute when the default helper is restored', async () => {
596607
element.appendChild(helper);
597608
await nextRender();

0 commit comments

Comments
 (0)