fix(field): changed order get label

This commit is contained in:
qa46hx 2020-02-06 14:51:26 +01:00
parent d67225984c
commit 868785b860
2 changed files with 4 additions and 4 deletions

View file

@ -54,7 +54,7 @@ export const FormControlMixin = dedupeMixin(
} }
get label() { get label() {
return (this._labelNode && this._labelNode.textContent) || this.__label; return this.__label || (this._labelNode && this._labelNode.textContent);
} }
set label(newValue) { set label(newValue) {
@ -64,7 +64,7 @@ export const FormControlMixin = dedupeMixin(
} }
get helpText() { get helpText() {
return (this._helpTextNode && this._helpTextNode.textContent) || this.__helpText; return this.__helpText || (this._helpTextNode && this._helpTextNode.textContent);
} }
set helpText(newValue) { set helpText(newValue) {

View file

@ -60,7 +60,7 @@ describe('FormControlMixin', () => {
${inputSlot} ${inputSlot}
</${tag}> </${tag}>
</${tag}>`); </${tag}>`);
expect(el.label).to.equal(undefined); expect(el.label).to.equal('');
}); });
it('can have a help-text', async () => { it('can have a help-text', async () => {
@ -100,7 +100,7 @@ describe('FormControlMixin', () => {
${inputSlot} ${inputSlot}
</${tag}> </${tag}>
</${tag}>`); </${tag}>`);
expect(el.helpText).to.equal(undefined); expect(el.helpText).to.equal('');
}); });
it('does not duplicate aria-describedby and aria-labelledby ids', async () => { it('does not duplicate aria-describedby and aria-labelledby ids', async () => {