Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
37 changes: 37 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue30463.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
namespace Maui.Controls.Sample.Issues;

[Issue(IssueTracker.Github, 30463, "Picker title is not displayed again", PlatformAffected.iOS)]
public class Issue30463 : ContentPage
{
public Issue30463()
{
VerticalStackLayout stackLayout = new VerticalStackLayout
{
Padding = 20,
Spacing = 10
};

Picker picker = new Picker
{
AutomationId = "RegainingPickerTitle",
Title = "Select an item",
ItemsSource = new List<string> { "Item 1", "Item 2", "Item 3" },
SelectedIndex = 1
};

Button button = new Button
{
AutomationId = "ToggleSelectedIndexBtn",
Text = "Click to change selected index to -1"
};
button.Clicked += (sender, e) =>
{
picker.SelectedIndex = -1;
};

stackLayout.Children.Add(picker);
stackLayout.Children.Add(button);
Content = stackLayout;
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

namespace Microsoft.Maui.TestCases.Tests.Issues;

public class Issue30463 : _IssuesUITest
{
public Issue30463(TestDevice device) : base(device) { }

public override string Issue => "Picker title is not displayed again";

[Test]
[Category(UITestCategories.Picker)]
public void PickerShouldRegainTitle()
{
App.WaitForElement("ToggleSelectedIndexBtn");
App.Tap("ToggleSelectedIndexBtn");
var pickerText = App.WaitForElement("RegainingPickerTitle").GetText();
#if ANDROID || MACCATALYST
Assert.That(pickerText, Is.EqualTo("Select an item"));
#else
Assert.That(pickerText, Is.Empty);
#endif
}
}
1 change: 1 addition & 0 deletions src/Core/src/Platform/iOS/PickerExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ internal static void UpdatePicker(this MauiPicker platformPicker, IPicker picker
}
else
{
platformPicker.Text = null;
platformPicker.UpdatePickerTitle(picker);
}

Expand Down
Loading