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
Original file line number Diff line number Diff line change
Expand Up @@ -1422,6 +1422,8 @@ void HandleChildPropertyChanged(object sender, PropertyChangedEventArgs e)
else if (e.PropertyName == NavigationPage.TitleIconImageSourceProperty.PropertyName ||
e.PropertyName == NavigationPage.TitleViewProperty.PropertyName)
UpdateTitleArea(Child);
else if (e.PropertyName == NavigationPage.BackButtonTitleProperty.PropertyName)
UpdateBackButtonTitle(Child);
else if (e.PropertyName == NavigationPage.IconColorProperty.PropertyName)
UpdateIconColor();
}
Expand Down
70 changes: 70 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue31539.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
using System.Collections.ObjectModel;

namespace Maui.Controls.Sample.Issues;

[Issue(IssueTracker.Github, 31539, "[iOS, macOS] Navigation Page BackButtonTitle Not Updating", PlatformAffected.iOS | PlatformAffected.macOS)]

public class Issue31539 : TestNavigationPage
{
protected override void Init()
{
Navigation.PushAsync(new Issue31539ContentPage());
}
}

public class Issue31539ContentPage : ContentPage
{
public Issue31539ContentPage()
{
var layout = new VerticalStackLayout
{
Padding = 20,
Spacing = 12
};

var pushButton = new Button
{
Text = "Push Second Page",
AutomationId = "PushSecondPage"
};
pushButton.Clicked += OnPushSecondPage;

var backTitleButton = new Button
{
Text = "Set BackButtonTitle = 'Back Home'",
AutomationId = "SetBackButtonTitle"
};
backTitleButton.Clicked += OnSetBackButtonTitle;

layout.Children.Add(pushButton);
layout.Children.Add(backTitleButton);

Content = layout;
}

void OnPushSecondPage(object sender, EventArgs e)
{
Navigation.PushAsync(new Issue31539SecondContentPage());
}

void OnSetBackButtonTitle(object sender, EventArgs e)
{
NavigationPage.SetBackButtonTitle(this, "Back Home");
}
}

public class Issue31539SecondContentPage : ContentPage
{
public Issue31539SecondContentPage()
{
Content = new StackLayout
{
Padding = 20,
Spacing = 12,
Children =
{
new Label { Text = "This is the second page.", AutomationId = "SecondPageLabel" }
}
};
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# if TEST_FAILS_ON_ANDROID && TEST_FAILS_ON_WINDOWS // BackButtonTitle is only applicable for iOS and macOS
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

namespace Microsoft.Maui.TestCases.Tests.Issues
{
public class Issue31539 : _IssuesUITest
{
public Issue31539(TestDevice device) : base(device) { }

public override string Issue => "[iOS, macOS] Navigation Page BackButtonTitle Not Updating";
[Test]
[Category(UITestCategories.Navigation)]
public void VerifyBackButtonTitleUpdates()
{
App.WaitForElement("PushSecondPage");
App.Tap("PushSecondPage");
App.TapBackArrow();
App.Tap("SetBackButtonTitle");
App.Tap("PushSecondPage");
App.WaitForElement("SecondPageLabel");
VerifyScreenshot();
}
}
}
#endif
Loading