diff --git a/dev/NavigationView/NavigationView.cpp b/dev/NavigationView/NavigationView.cpp index 71027d8524..a4b900be4a 100644 --- a/dev/NavigationView/NavigationView.cpp +++ b/dev/NavigationView/NavigationView.cpp @@ -584,8 +584,10 @@ void NavigationView::UpdateAdaptiveLayout(double width, bool forceSetDisplayMode { MUX_FAIL_FAST(); } + if (!forceSetDisplayMode && m_InitialNonForcedModeUpdate) { - if (displayMode == winrt::NavigationViewDisplayMode::Minimal && PaneDisplayMode() == winrt::NavigationViewPaneDisplayMode::Auto) { + if (displayMode == winrt::NavigationViewDisplayMode::Minimal || + displayMode == winrt::NavigationViewDisplayMode::Compact) { ClosePane(); } m_InitialNonForcedModeUpdate = false; diff --git a/dev/NavigationView/NavigationView_ApiTests/NavigationViewTests.cs b/dev/NavigationView/NavigationView_ApiTests/NavigationViewTests.cs index 2b34ad84ae..93173d322a 100644 --- a/dev/NavigationView/NavigationView_ApiTests/NavigationViewTests.cs +++ b/dev/NavigationView/NavigationView_ApiTests/NavigationViewTests.cs @@ -319,6 +319,7 @@ public void VerifySettingsItemToolTip() navView.IsSettingsVisible = true; navView.IsPaneOpen = true; + navView.PaneDisplayMode = NavigationViewPaneDisplayMode.Left; MUXControlsTestApp.App.TestContentRoot = navView; }); diff --git a/dev/NavigationView/NavigationView_InteractionTests/NavigationViewTests.cs b/dev/NavigationView/NavigationView_InteractionTests/NavigationViewTests.cs index f6d9a54073..5d4f91b352 100644 --- a/dev/NavigationView/NavigationView_InteractionTests/NavigationViewTests.cs +++ b/dev/NavigationView/NavigationView_InteractionTests/NavigationViewTests.cs @@ -445,18 +445,25 @@ public void PaneOpenForceCloseTest() [TestMethod] [TestProperty("TestSuite", "A")] - public void PaneClosedWhenAutoAndNarrow() + public void PaneClosedUponLaunch() { var testScenarios = RegressionTestScenario.BuildLeftNavRegressionTestScenarios(); foreach (var testScenario in testScenarios) { using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", "Navigation Minimal Test" })) { - - CheckBox isPaneOpenCheckBox = new CheckBox(FindElement.ById("IsAutoPaneOpenCheckBox")); - Log.Comment("Checking that a NavigationView with displaymode set to 'Auto' and a narrow width does not display pane"); + Log.Comment("Verify that NavigationView with DisplayMode set to 'Auto' and a narrow width does not display pane on load."); + CheckBox isAutoPaneOpenCheckBox = new CheckBox(FindElement.ById("IsAutoPaneOpenCheckBox")); Wait.ForIdle(); - Verify.IsTrue(isPaneOpenCheckBox.ToggleState == ToggleState.Off); + Verify.IsTrue(isAutoPaneOpenCheckBox.ToggleState == ToggleState.Off); + + Log.Comment("Verify that NavigationView with DisplayMode set to 'LeftMinimal' does not display pane on load."); + CheckBox isLeftMinimalPaneOpenCheckBox = new CheckBox(FindElement.ById("IsLeftMinimalPaneOpenCheckBox")); + Verify.IsTrue(isLeftMinimalPaneOpenCheckBox.ToggleState == ToggleState.Off); + + Log.Comment("Verify that NavigationView with DisplayMode set to 'LeftCompact' does not display pane on load."); + CheckBox isLeftCompactPaneOpenCheckBox = new CheckBox(FindElement.ById("IsLeftCompactPaneOpenCheckBox")); + Verify.IsTrue(isLeftCompactPaneOpenCheckBox.ToggleState == ToggleState.Off); } } diff --git a/dev/NavigationView/TestUI/NavigationViewMinimalPage.xaml b/dev/NavigationView/TestUI/NavigationViewMinimalPage.xaml index da6e0ff46d..40249fadf2 100644 --- a/dev/NavigationView/TestUI/NavigationViewMinimalPage.xaml +++ b/dev/NavigationView/TestUI/NavigationViewMinimalPage.xaml @@ -11,21 +11,38 @@ Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> - - - -