Skip to content

Commit

Permalink
feat(iOS): Add CommandBar UITest
Browse files Browse the repository at this point in the history
  • Loading branch information
ajpinedam committed Jan 21, 2021
1 parent 66e661b commit 1f0ea0c
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/SamplesApp/SamplesApp.Shared/App.xaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<Application x:Class="SamplesApp.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:xamarin="http://nventive.com/xamarin"
xmlns:ios="http://nventive.com/ios"
xmlns:toolkit="using:Uno.UI.Toolkit"
RequestedTheme="Light">
<Application.Resources>
<ResourceDictionary>
Expand Down Expand Up @@ -109,6 +112,19 @@
Value="LightBlue" />
</Style>

<Style x:Key="DefaultCommandBarStyle"
TargetType="CommandBar"
xamarin:BasedOn="{StaticResource NativeDefaultCommandBar}">

<!-- Remove the back button title (and only leave the back arrow) -->
<ios:Setter Property="(toolkit:CommandBarExtensions.BackButtonTitle)"
Value="" />
</Style>

<!-- Default Style -->
<Style TargetType="CommandBar"
BasedOn="{StaticResource DefaultCommandBarStyle}" />

</ResourceDictionary>

</Application.Resources>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,5 +203,25 @@ public void When_Navigated_CommandBarShouldKeepColor_Native_Frame()

ImageAssert.AreEqual(initial, final);
}

[Test]
[AutoRetry]
[ActivePlatforms(Platform.iOS)]
public void When_Navigated_CommandBarShouldHideBackButtonTitle_NativeFrame()
{
Run("UITests.Windows_UI_Xaml_Controls.CommandBar.BackButtonTitle.CommandBar_Frame");

_app.WaitForElement("NavigateInitialButton");
_app.FastTap("NavigateInitialButton");

_app.WaitForElement("NavigateToPage2Button");
_app.FastTap("NavigateToPage2Button");

_app.WaitForElement("Page2CommandBar");

var backButtonText = _app.Marked("Back").FirstResult();

Assert.IsNull(backButtonText);
}
}
}

0 comments on commit 1f0ea0c

Please sign in to comment.