File tree Expand file tree Collapse file tree 3 files changed +35
-2
lines changed
Expand file tree Collapse file tree 3 files changed +35
-2
lines changed Original file line number Diff line number Diff line change @@ -271,7 +271,7 @@ void CommandBarFlyout::SetSecondaryCommandsToCloseWhenExecuted()
271271 auto button = element.try_as <winrt::AppBarButton>();
272272 auto toggleButton = element.try_as <winrt::AppBarToggleButton>();
273273
274- if (button)
274+ if (button && !button. Flyout () )
275275 {
276276 m_secondaryButtonClickRevokerByIndexMap[i] = button.Click (winrt::auto_revoke, closeFlyoutFunc);
277277 }
Original file line number Diff line number Diff line change @@ -188,6 +188,39 @@ public void CanTapOnSecondaryItems()
188188 }
189189 }
190190
191+ [ TestMethod ]
192+ public void CanTapOnSecondaryItemWithFlyoutWithoutClosing ( )
193+ {
194+ using ( var setup = new CommandBarFlyoutTestSetupHelper ( ) )
195+ {
196+ Button showCommandBarFlyoutButton = FindElement . ByName < Button > ( "Show CommandBarFlyout with sub-menu" ) ;
197+ ToggleButton isFlyoutOpenCheckBox = FindElement . ById < ToggleButton > ( "IsFlyoutOpenCheckBox" ) ;
198+
199+ Action openCommandBarAction = ( ) =>
200+ {
201+ Log . Comment ( "Tapping on a button to show the CommandBarFlyout." ) ;
202+ InputHelper . Tap ( showCommandBarFlyoutButton ) ;
203+
204+ // Pre-RS5, CommandBarFlyouts always open expanded,
205+ // so we don't need to tap on the more button in that case.
206+ if ( PlatformConfiguration . IsOsVersionGreaterThanOrEqual ( OSVersion . Redstone5 ) )
207+ {
208+ Log . Comment ( "Expanding the CommandBar by invoking the more button." ) ;
209+ FindElement . ById < Button > ( "MoreButton" ) . InvokeAndWait ( ) ;
210+ }
211+ } ;
212+
213+ Log . Comment ( "Opening the CommandBar and invoking the first button in the secondary commands list." ) ;
214+ openCommandBarAction ( ) ;
215+
216+
217+ setup . ExecuteAndWaitForEvents ( ( ) => FindElement . ById < Button > ( "ProofingButton" ) . Invoke ( ) , new List < string > ( ) { "ProofingButton clicked" } ) ;
218+
219+
220+ Verify . IsTrue ( isFlyoutOpenCheckBox . ToggleState == ToggleState . On ) ;
221+ }
222+ }
223+
191224 [ TestMethod ]
192225 public void VerifyTabNavigationBetweenPrimaryAndSecondaryCommands ( )
193226 {
Original file line number Diff line number Diff line change 9595 <AppBarButton x : Name =" ItalicButton5" AutomationProperties.AutomationId=" ItalicButton5" Label =" Italic" Icon =" Italic" Click =" OnElementClicked" />
9696 <AppBarButton x : Name =" UnderlineButton5" AutomationProperties.AutomationId=" UnderlineButton5" Label =" Underline" Icon =" Underline" Click =" OnElementClicked" />
9797 <muxc : CommandBarFlyout .SecondaryCommands>
98- <AppBarButton Label =" Proofing" >
98+ <AppBarButton x : Name = " ProofingButton " AutomationProperties.AutomationId= " ProofingButton " Label =" Proofing" Click = " OnElementClicked " >
9999 <AppBarButton .Flyout>
100100 <MenuFlyout >
101101 <MenuFlyoutItem Text =" talk" />
You can’t perform that action at this time.
0 commit comments