Skip to content

Commit

Permalink
NavView Hamburger btn and header overlap on launch in minimal mode (#652
Browse files Browse the repository at this point in the history
)

* fixed hamburger overlap on launch

* fix for hamburgerbtn header overlap

* added test

* minor cleanup

* addressed comments

* fixed typo
  • Loading branch information
ojhad authored May 6, 2019
1 parent 1cfb9cb commit 59a2700
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 0 deletions.
1 change: 1 addition & 0 deletions dev/NavigationView/NavigationView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2586,6 +2586,7 @@ void NavigationView::OnPropertyChanged(const winrt::DependencyPropertyChangedEve
if (property == s_IsPaneOpenProperty)
{
OnIsPaneOpenChanged();
UpdateVisualStateForDisplayModeGroup(DisplayMode());
}
else if (property == s_CompactModeThresholdWidthProperty ||
property == s_ExpandedModeThresholdWidthProperty)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3803,6 +3803,24 @@ public void EnsureDisplayModeGroupUpdatesWhenBackButtonVisibilityChanged()
}
}

[TestMethod]
[TestProperty("NavViewTestSuite", "D")]
public void EnsureDisplayModeGroupUpdatesOnPaneClosedToMinimalWithBackButton()
{
using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", "Navigation Minimal Test" }))
{
Log.Comment("Click on ToggleButton");
FindElement.ById<Button>("TogglePaneButton").InvokeAndWait();

Log.Comment("Get NavView Active VisualStates");
FindElement.ByName<Button>("GetNavViewActiveVisualStates").InvokeAndWait();

const string visualStateName = "MinimalWithBackButton";
var result = new TextBlock(FindElement.ByName("NavViewActiveVisualStatesResult"));
Verify.IsTrue(result.GetText().Contains(visualStateName), "Active VisualStates should include " + visualStateName);
}
}

// Test for issue 450 https://github.com/Microsoft/microsoft-ui-xaml/issues/450
[TestMethod]
[TestProperty("TestSuite", "D")]
Expand Down
1 change: 1 addition & 0 deletions dev/NavigationView/TestUI/NavigationViewCaseBundle.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<Button x:Name="NavigateToTopNavPage" AutomationProperties.Name="Top Nav Test" Margin="2" HorizontalAlignment="Stretch">Top Nav Test</Button>
<Button x:Name="NavigateToAnimationPage" AutomationProperties.Name="Navigation Animation Test" Margin="2" HorizontalAlignment="Stretch">Navigation Animation Test</Button>
<Button x:Name="NavigateToIsPaneOpenPage" AutomationProperties.Name="Navigation IsPaneOpen Test" Margin="2" HorizontalAlignment="Stretch">Navigation IsPaneOpen Test</Button>
<Button x:Name="NavigateToMinimalPage" AutomationProperties.Name="Navigation Minimal Test" Margin="2" HorizontalAlignment="Stretch">Navigation Minimal Test</Button>
</StackPanel>
</Grid>
</local:TestPage>
1 change: 1 addition & 0 deletions dev/NavigationView/TestUI/NavigationViewCaseBundle.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public NavigationViewCaseBundle()
NavigateToTopNavPage.Click += delegate { Frame.NavigateWithoutAnimation(typeof(NavigationViewTopNavStorePage), 0); };
NavigateToAnimationPage.Click += delegate { Frame.NavigateWithoutAnimation(typeof(NavigationViewAnimationPage), 0); };
NavigateToIsPaneOpenPage.Click += delegate { Frame.NavigateWithoutAnimation(typeof(NavigationViewIsPaneOpenPage), 0); };
NavigateToMinimalPage.Click += delegate { Frame.NavigateWithoutAnimation(typeof(NavigationViewMinimalPage), 0); };
}

}
Expand Down
22 changes: 22 additions & 0 deletions dev/NavigationView/TestUI/NavigationViewMinimalPage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See LICENSE in the project root for license information. -->
<local:TestPage
x:Class="MUXControlsTestApp.NavigationViewMinimalPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:MUXControlsTestApp"
xmlns:muxcontrols="using:Microsoft.UI.Xaml.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<!-- This page contains a NavigationView control that is in LeftMinimal mode on initial load -->
<Grid>
<muxcontrols:NavigationView x:Name="NavView" AutomationProperties.Name="NavView" AutomationProperties.AutomationId="NavView"
IsBackEnabled="True" Header="Minimal Test Page" PaneDisplayMode="LeftMinimal">
<StackPanel>
<TextBlock x:Name="NavViewActiveVisualStatesResult" AutomationProperties.Name="NavViewActiveVisualStatesResult"/>
<Button x:Name="GetNavViewActiveVisualStates" AutomationProperties.Name="GetNavViewActiveVisualStates" Content="GetNavViewActiveVisualStates" Click="GetNavViewActiveVisualStates_Click"/>
</StackPanel>
</muxcontrols:NavigationView>
</Grid>
</local:TestPage>
20 changes: 20 additions & 0 deletions dev/NavigationView/TestUI/NavigationViewMinimalPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using Windows.UI.Xaml;

namespace MUXControlsTestApp
{
public sealed partial class NavigationViewMinimalPage : TestPage
{
public NavigationViewMinimalPage()
{
this.InitializeComponent();
}

private void GetNavViewActiveVisualStates_Click(object sender, RoutedEventArgs e)
{
var visualstates = Utilities.VisualStateHelper.GetCurrentVisualStateName(NavView);
NavViewActiveVisualStatesResult.Text = string.Join(",", visualstates);
}
}
}
7 changes: 7 additions & 0 deletions dev/NavigationView/TestUI/NavigationView_TestUI.projitems
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="$(MSBuildThisFileDirectory)NavigationViewMinimalPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="$(MSBuildThisFileDirectory)NavigationViewStretchPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand Down Expand Up @@ -84,6 +88,9 @@
<Compile Include="$(MSBuildThisFileDirectory)NavigationViewIsPaneOpenPage.xaml.cs">
<DependentUpon>NavigationViewIsPaneOpenPage.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)NavigationViewMinimalPage.xaml.cs">
<DependentUpon>NavigationViewMinimalPage.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)NavigationViewStretchPage.xaml.cs">
<DependentUpon>NavigationViewStretchPage.xaml</DependentUpon>
</Compile>
Expand Down

0 comments on commit 59a2700

Please sign in to comment.