Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ private void init() {
setFocusable(true);
setFocusableInTouchMode(true);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
setImportantForAutofill(View.IMPORTANT_FOR_AUTOFILL_YES_EXCLUDE_DESCENDANTS);
setImportantForAutofill(View.IMPORTANT_FOR_AUTOFILL_YES);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,15 @@ public void attachToFlutterEngine_alertsPlatformViews() {
verify(platformViewsController, times(1)).attachToView(flutterView);
}

@Test
public void flutterView_importantForAutofillDoesNotExcludeDescendants() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible to test not that the value is set but instead that a child view can have autofill?
This feels a bit like a change detector test.

Copy link
Contributor

Choose a reason for hiding this comment

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

Does this test need to indicate that it should only run for android o and above?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is it possible to test not that the value is set but instead that a child view can have autofill?
This feels a bit like a change detector test.

I wasn't able to find a way to test if child views receive autofills automatically. I tried to manually call autofill with no luck. And the documentation only provides an example to test it manually: https://developer.android.com/guide/topics/text/autofill-optimize.

Does this test need to indicate that it should only run for android o and above?

I believe the method is only callable on versions O and above. Without the version check, we would get lint warnings that the method would cause crashes on lower versions.

FlutterView flutterView = new FlutterView(Robolectric.setupActivity(Activity.class));

// Value should not exclude descendants because platform views are added as child views and
// can be eligible for autofill (e.g. a WebView).
assertEquals(View.IMPORTANT_FOR_AUTOFILL_YES, flutterView.getImportantForAutofill());
}

@Test
public void detachFromFlutterEngine_alertsPlatformViews() {
FlutterView flutterView = new FlutterView(Robolectric.setupActivity(Activity.class));
Expand Down