Skip to content

Commit 7e1a7ef

Browse files
author
Mikhail Bashkirov
committed
fix(field): fix form registration in Edge
1 parent 98c7444 commit 7e1a7ef

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

packages/field/src/FormControlMixin.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ export const FormControlMixin = dedupeMixin(
145145
* will requires a `await nextFrame()` in tests
146146
*/
147147
_registerFormElement() {
148-
requestAnimationFrame(() => {
148+
this.updateComplete.then(() => {
149149
this.dispatchEvent(
150150
new CustomEvent('form-element-register', {
151151
detail: { element: this },
@@ -164,7 +164,7 @@ export const FormControlMixin = dedupeMixin(
164164
* @see {@link this._registerFormElement}
165165
*/
166166
_requestParentFormGroupUpdateOfResetModelValue() {
167-
requestAnimationFrame(() => {
167+
this.updateComplete.then(() => {
168168
if (this.__parentFormGroup) {
169169
this.__parentFormGroup._updateResetModelValue();
170170
}

packages/fieldset/test/lion-fieldset.test.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,8 @@ describe('<lion-fieldset>', () => {
518518
<lion-input id="firstName" name="firstName" .modelValue="${'Foo'}"></lion-input>
519519
</lion-fieldset>
520520
`);
521-
await nextFrame();
521+
await el.querySelector('lion-input').updateComplete;
522+
522523
const input = el.querySelector('#firstName');
523524

524525
input.modelValue = 'Bar';
@@ -536,7 +537,8 @@ describe('<lion-fieldset>', () => {
536537
<lion-input id="firstName" name="firstName[]" .modelValue="${'Foo'}"></lion-input>
537538
</lion-fieldset>
538539
`);
539-
await nextFrame();
540+
await el.querySelector('lion-input').updateComplete;
541+
540542
const input = el.querySelector('#firstName');
541543

542544
input.modelValue = 'Bar';
@@ -556,9 +558,11 @@ describe('<lion-fieldset>', () => {
556558
</lion-fieldset>
557559
</lion-fieldset>
558560
`);
559-
// 2 times as we are nested here
560-
await nextFrame();
561-
await nextFrame();
561+
await Promise.all([
562+
el.querySelector('lion-fieldset').updateComplete,
563+
el.querySelector('lion-input').updateComplete,
564+
]);
565+
562566
const input = el.querySelector('#firstName');
563567
const nestedFieldset = el.querySelector('#name');
564568

0 commit comments

Comments
 (0)