-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Shell BackButtonBehavior improvement (#23466)
* Shell BackButtonBehavior improvement (#23424) * Update ShellPageRendererTracker.cs * CR comments resolved * - snapshots --------- Co-authored-by: Shane Neuville <shneuvil@microsoft.com>
- Loading branch information
Showing
6 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+24.9 KB
...roid.Tests/snapshots/android/BackButtonBehaviorIsVisibleWorksWithCustomIcon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions
35
src/Controls/tests/TestCases.HostApp/Issues/Issue23424.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
namespace Maui.Controls.Sample.Issues; | ||
|
||
[XamlCompilation(XamlCompilationOptions.Compile)] | ||
[Issue(IssueTracker.Github, "23424", "BackButtonBehavior IsVisible=False does not hide the back button", PlatformAffected.All)] | ||
public partial class Issue23424 : Shell | ||
{ | ||
public Issue23424() | ||
{ | ||
Items.Add(new ContentPage()); | ||
Navigation.PushAsync(new DetailPage()); | ||
} | ||
|
||
public class DetailPage : ContentPage | ||
{ | ||
public DetailPage() | ||
{ | ||
Title = "Detail page"; | ||
BackButtonBehavior backButtonBehavior = new BackButtonBehavior | ||
{ | ||
IconOverride = "small_dotnet_bot.png" | ||
}; | ||
|
||
SetBackButtonBehavior(this, backButtonBehavior); | ||
Content = new VerticalStackLayout() | ||
{ | ||
new Button() | ||
{ | ||
AutomationId = "button", | ||
Text = "Click to hide the back button", | ||
Command = new Command(()=>backButtonBehavior.IsVisible =! backButtonBehavior.IsVisible) | ||
} | ||
}; | ||
} | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue23424.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#if !MACCATALYST | ||
using NUnit.Framework; | ||
using UITest.Appium; | ||
using UITest.Core; | ||
|
||
namespace Microsoft.Maui.TestCases.Tests.Issues | ||
{ | ||
public class Issue23424: _IssuesUITest | ||
{ | ||
public Issue23424(TestDevice device) : base(device) | ||
{ | ||
} | ||
|
||
public override string Issue => "BackButtonBehavior IsVisible=False does not hide the back button"; | ||
|
||
[Test] | ||
[Category(UITestCategories.Shell)] | ||
public void BackButtonBehaviorIsVisibleWorksWithCustomIcon() | ||
{ | ||
App.WaitForElement("button"); | ||
App.Click("button"); | ||
|
||
// The test passes if the back button is not visible | ||
VerifyScreenshot(); | ||
} | ||
} | ||
} | ||
#endif |
Binary file added
BIN
+8.54 KB
...inUI.Tests/snapshots/windows/BackButtonBehaviorIsVisibleWorksWithCustomIcon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+25 KB
...ases.iOS.Tests/snapshots/ios/BackButtonBehaviorIsVisibleWorksWithCustomIcon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.