-
Notifications
You must be signed in to change notification settings - Fork 6.8k
fix(form-field): label gap not being calculated when switching to outline dynamically #11658
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(form-field): label gap not being calculated when switching to outline dynamically #11658
Conversation
@@ -148,6 +148,11 @@ export class MatFormField extends _MatFormFieldMixinBase | |||
return this._appearance || this._defaultOptions && this._defaultOptions.appearance || 'legacy'; | |||
} | |||
set appearance(value: MatFormFieldAppearance) { | |||
// If we're switching to `outline` from another appearance, we have to recalculate the gap. | |||
if (value !== this._appearance && value === 'outline') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we add a test for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't able to get it to measure the element within a unit test. IIRC I wasn't able to get that Promise.resolve
to flush correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did you try just doing a real async test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got some time to take a better look and it turns out that my test wasn't working because it didn't have a label. I've pushed a test that fails when we expect it to.
…line dynamically Fixes the form field gap not being calculated if the field switches to the `outline` appearance after init. Fixes angular#11653.
fbf28d9
to
dc8ea5a
Compare
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Fixes the form field gap not being calculated if the field switches to the
outline
appearance after init.Fixes #11653.