Skip to content
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 @@ -240,22 +240,34 @@ private async void OnSetDetail2Clicked(object sender, EventArgs e)
{
if (this.Detail is NavigationPage navPage)
{
var detailPage = new ContentPage
var detailLayout = new VerticalStackLayout
{
Title = "Detail 2",
Content = new VerticalStackLayout
Children =
{
Children =
{
new Label { Text = "Detail 2 - Content" },
new Button {
Text = "Back to Original Page",
AutomationId = "BackToOriginalDetailButton2",
Command = new Command(async () => await navPage.PopAsync())
}
}
new Label { Text = "Detail 2 - Content" },
new Button {
Text = "Back to Original Page",
AutomationId = "BackToOriginalDetailButton2",
Command = new Command(async () => await navPage.PopAsync())
}
}
};
if (_viewModel.ShouldHandleBackButton)
{
var handledLabel = new Label
{
AutomationId = "Detail2BackButtonHandledLabel",
BindingContext = _viewModel
};
handledLabel.SetBinding(Label.TextProperty, nameof(FlyoutPageViewModel.BackButtonHandled));
detailLayout.Children.Add(handledLabel);
}

var detailPage = new ContentPage
{
Title = "Detail 2",
Content = detailLayout
};
detailPage.NavigatedTo += OnPageNavigatedTo;
detailPage.NavigatingFrom += OnPageNavigatingFrom;
detailPage.NavigatedFrom += OnPageNavigatedFrom;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -502,15 +502,16 @@ public void Flyout_BackButtonPressed_Handled_True_Should_Stop_Navigation()

App.WaitForElement("SetDetail2Button");
App.Tap("SetDetail2Button");
App.WaitForElement("BackToOriginalDetailButton2");
Assert.That(App.FindElement("Detail2BackButtonHandledLabel")?.GetText(), Is.EqualTo("False"));

App.TapBackArrow();

// If handled → STILL on new page
App.WaitForElement("BackToOriginalDetailButton2");
App.Tap("BackToOriginalDetailButton2");

Assert.That(App.FindElement("BackButtonHandledLabel").GetText(), Is.EqualTo("True"));
Assert.That(App.FindElement("BackToOriginalDetailButton2")?.IsDisplayed(), Is.True);
Assert.That(App.FindElement("Detail2BackButtonHandledLabel")?.GetText(), Is.EqualTo("True"));

App.Tap("BackToOriginalDetailButton2");
}

#endif
Expand Down
Loading