Skip to content

Commit

Permalink
[TextInputLayout] Added id for errorIconView
Browse files Browse the repository at this point in the history
Resolves #1624
Resolves #1623

GIT_ORIGIN_REV_ID=acf854dc995d734383ed25689b8efd7606f75537
PiperOrigin-RevId: 327673226
  • Loading branch information
momvart authored and leticiarossi committed Aug 20, 2020
1 parent a543032 commit ee93fc1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,7 @@ public TextInputLayout(@NonNull Context context, @Nullable AttributeSet attrs, i
(CheckableImageButton)
LayoutInflater.from(getContext())
.inflate(R.layout.design_text_input_end_icon, endLayout, false);
errorIconView.setId(R.id.text_input_error_icon);
errorIconView.setVisibility(GONE);
if (MaterialResources.isFontScaleAtLeast1_3(context)) {
ViewGroup.MarginLayoutParams lp =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
<item name="textinput_placeholder" type="id"/>
<item name="textinput_prefix_text" type="id"/>
<item name="textinput_suffix_text" type="id"/>

<item name="text_input_error_icon" type="id"/>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ public void testErrorIconOnClickListener() {
// Click error icon
onView(
allOf(
withId(R.id.text_input_end_icon),
withId(R.id.text_input_error_icon),
withContentDescription(R.string.error_icon_content_description),
isDescendantOfA(withId(R.id.textinput_no_icon))))
.perform(click());
Expand Down Expand Up @@ -591,7 +591,7 @@ public void testErrorIconAppears() {
// Check the icon is visible
onView(
allOf(
withId(R.id.text_input_end_icon),
withId(R.id.text_input_error_icon),
withContentDescription(R.string.error_icon_content_description),
isDescendantOfA(withId(R.id.textinput_no_icon))))
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)));
Expand Down Expand Up @@ -643,7 +643,7 @@ public void testErrorIconMaintainsEndIcon() {
// Check icon showing is error icon only
onView(
allOf(
withId(R.id.text_input_end_icon),
withId(R.id.text_input_error_icon),
withContentDescription(R.string.error_icon_content_description),
isDescendantOfA(withId(R.id.textinput_password))))
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)));
Expand All @@ -660,7 +660,7 @@ public void testErrorIconMaintainsEndIcon() {
// Check end icon is back
onView(
allOf(
withId(R.id.text_input_end_icon),
withId(R.id.text_input_error_icon),
withContentDescription(R.string.error_icon_content_description),
isDescendantOfA(withId(R.id.textinput_password))))
.check(matches(withEffectiveVisibility(Visibility.GONE)));
Expand Down

0 comments on commit ee93fc1

Please sign in to comment.