Skip to content

Add DropdownButtonFormField value param test - #170518

Merged
auto-submit[bot] merged 4 commits into
flutter:masterfrom
alex-medinsh:dropdownbuttonformfield-test
Jun 16, 2025
Merged

auto-submit[bot] merged 4 commits into
flutter:masterfrom
alex-medinsh:dropdownbuttonformfield-test

Conversation

@alex-medinsh

@alex-medinsh alex-medinsh commented Jun 12, 2025 •

Copy link
Copy Markdown
Contributor

This PR adds a new test that verifies that the value param is only used on initial build and when resetting the field.

Test for #170050 (comment)

Pre-launch Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement].
  • I signed the [CLA].
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is [test-exempt].
  • I followed the [breaking change policy] and added [Data Driven Fixes] where supported.
  • All existing and new tests are passing.

@github-actions github-actions Bot added framework flutter/packages/flutter repository. See also f: labels. p: material_ui material_ui package in flutter/packages labels Jun 12, 2025
@alex-medinsh

Copy link
Copy Markdown
Contributor Author

Should this have an issue? Never seen a PR that just adds a test.

@alex-medinsh
alex-medinsh marked this pull request as ready for review June 12, 2025 13:10

@bleroux bleroux left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for filing this PR!
This test is badly required as no existing test is checking the reset function and the mapping of DropdownButtonFormField.value to FormFieldState.initialValue.

I wrote some suggestions to improve readability.

Comment thread packages/flutter/test/material/dropdown_test.dart Outdated
Comment thread packages/flutter/test/material/dropdown_test.dart
@bleroux

bleroux commented Jun 12, 2025

Copy link
Copy Markdown
Contributor

Should this have an issue? Never seen a PR that just adds a test.

In that particular case, you can link to #170050, it is the best way to give context to reviewers and future contributors.

On a side note, it is true that PRs that just add tests are not common, but it is always useful to improve test coverage (I filed several PRs to add mlssing M3 tests for InputDecoration and still need to file some 😅 )

@alex-medinsh

Copy link
Copy Markdown
Contributor Author

I've made the requested changes, please take a look.

@bleroux bleroux left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!
With such a test, a change such as #170050 will failed. Thanks for improving the test coverage 🙏

I just let some very minor suggestions.

Comment thread packages/flutter/test/material/dropdown_test.dart Outdated
Comment thread packages/flutter/test/material/dropdown_test.dart Outdated
Comment thread packages/flutter/test/material/dropdown_test.dart Outdated
Comment thread packages/flutter/test/material/dropdown_test.dart Outdated
@bleroux
bleroux requested a review from justinmc June 12, 2025 17:16

@justinmc justinmc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍 Thanks for following up from the other PR to make this test change.

Comment thread packages/flutter/test/material/dropdown_test.dart Outdated
@bleroux bleroux added the autosubmit Merge PR when tree becomes green via auto submit App label Jun 16, 2025
@auto-submit
auto-submit Bot added this pull request to the merge queue Jun 16, 2025
Merged via the queue into flutter:master with commit fc7c97c Jun 16, 2025
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jun 16, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 17, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 17, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 17, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 17, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 17, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 17, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 17, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 18, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 18, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 18, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 18, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 18, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 18, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 18, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 19, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 19, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 19, 2025
@alex-medinsh
alex-medinsh deleted the dropdownbuttonformfield-test branch July 2, 2025 08:01
mboetger pushed a commit to mboetger/flutter that referenced this pull request Jul 21, 2025
This PR adds a new test that verifies that the value param is only used
on initial build and when resetting the field.

Test for
flutter#170050 (comment)

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

---------

Co-authored-by: Bruno Leroux <[email protected]>
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 15, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 15, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

framework flutter/packages/flutter repository. See also f: labels. p: material_ui material_ui package in flutter/packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants