-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Add unit tests for TabBar and FlyoutItem navigation ApplyQueryAttributes (#25663) #33006
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds comprehensive unit tests to validate that IQueryAttributable.ApplyQueryAttributes is invoked correctly for all Shell navigation scenarios, complementing the fix implementation in PR #25663.
The PR introduces:
- UI test infrastructure with a Shell-based test page (
Issue13537) demonstrating TabBar navigation and query attribute handling - Three UI test cases covering push/pop navigation and tab switching with query parameters
- Six xUnit test cases validating QueryAttributesProperty behavior for different Shell navigation patterns
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 18 comments.
Show a summary per file
| File | Description |
|---|---|
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue13537.cs |
Adds UI tests for ApplyQueryAttributes behavior with push/pop navigation and tab switching |
src/Controls/tests/TestCases.HostApp/Issues/Issue13537.xaml.cs |
Implements test pages with IQueryAttributable support for demonstrating Shell navigation scenarios |
src/Controls/tests/TestCases.HostApp/Issues/Issue13537.xaml |
Defines Shell TabBar structure for UI tests |
src/Controls/tests/Core.UnitTests/ShellParameterPassingTests.cs |
Adds unit tests validating QueryAttributesProperty behavior for TabBar, FlyoutItem, and ShellSection navigation |
src/Controls/src/Core/Shell/ShellNavigationManager.cs |
Updates ApplyQueryAttributes to set QueryAttributesProperty on ShellContent during pop navigation |
src/Controls/src/Core/Shell/ShellItem.cs |
Sets QueryAttributesProperty when switching between TabBar items |
src/Controls/src/Core/Shell/Shell.cs |
Sets QueryAttributesProperty when navigating between FlyoutItems or ShellGroupItems |
| var viewModel = new Issue13537ViewModel<Issue13537HomePage>(); | ||
| this.BindingContext = viewModel; | ||
|
|
||
| var Label = new Label |
Copilot
AI
Dec 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Variable name should follow C# naming conventions. Local variables should be in camelCase, not PascalCase. Change Label to label.
| Text = "Navigate using PushAsync", | ||
| AutomationId = "PushAsyncButton", | ||
| HorizontalOptions =LayoutOptions.Center, | ||
| VerticalOptions=LayoutOptions.Center |
Copilot
AI
Dec 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing space after =. Should be VerticalOptions = LayoutOptions.Center for consistency with the rest of the codebase.
| VerticalOptions=LayoutOptions.Center | |
| VerticalOptions = LayoutOptions.Center |
| var Parameter = new Dictionary<string, object> | ||
| { | ||
| { $"Parameter From {Shell.Current.CurrentPage.Title} Page", $"to New Page" }, | ||
|
|
||
| }; | ||
| Shell.Current.GoToAsync("NewPage",parameters:Parameter); |
Copilot
AI
Dec 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Variable name should follow C# naming conventions. Local variables should be in camelCase, not PascalCase. Change Parameter to parameter.
| var Parameter = new Dictionary<string, object> | |
| { | |
| { $"Parameter From {Shell.Current.CurrentPage.Title} Page", $"to New Page" }, | |
| }; | |
| Shell.Current.GoToAsync("NewPage",parameters:Parameter); | |
| var parameter = new Dictionary<string, object> | |
| { | |
| { $"Parameter From {Shell.Current.CurrentPage.Title} Page", $"to New Page" }, | |
| }; | |
| Shell.Current.GoToAsync("NewPage", parameters: parameter); |
| shell.UpdateCurrentState(ShellNavigationSource.ShellSectionChanged); | ||
| } | ||
|
|
||
| //For TabBarItems itemchanged will fall in ShellItem class , we need to set the QueryAttributesProperty here |
Copilot
AI
Dec 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment "For TabBarItems itemchanged will fall in ShellItem class" has a grammatical issue. Should be: "For TabBar items, the item changed event will fall into the ShellItem class" or "For TabBar items, item changes are handled in the ShellItem class".
| //For TabBarItems itemchanged will fall in ShellItem class , we need to set the QueryAttributesProperty here | |
| // For TabBar items, the item changed event will fall into the ShellItem class, so we need to set the QueryAttributesProperty here. |
| } | ||
|
|
||
| #if TEST_FAILS_ON_CATALYST | ||
| //App.TapBackArrow doesnot actually tab the back arrow button instead it taps the first tab element on the screen as both have the same access identifier. |
Copilot
AI
Dec 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The typo "tab" should be "tap" in the comment. "Doesnot" should be two words: "does not".
| //App.TapBackArrow doesnot actually tab the back arrow button instead it taps the first tab element on the screen as both have the same access identifier. | |
| //App.TapBackArrow does not actually tap the back arrow button; instead, it taps the first tab element on the screen as both have the same access identifier. |
| var viewModel = new Issue13537ViewModel<Issue13537FavoritePage>(); | ||
| this.BindingContext = viewModel; | ||
|
|
||
| var Label = new Label |
Copilot
AI
Dec 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Variable name should follow C# naming conventions. Local variables should be in camelCase, not PascalCase. Change Label to label.
| { $"Parameter From {Shell.Current.CurrentPage.Title} Page", $"to New Page" }, | ||
|
|
||
| }; | ||
| Shell.Current.GoToAsync("NewPage",parameters:Parameter); |
Copilot
AI
Dec 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing space after parameters:. Should be parameters: Parameter for consistency with C# formatting conventions.
| Shell.Current.GoToAsync("NewPage",parameters:Parameter); | |
| Shell.Current.GoToAsync("NewPage", parameters: Parameter); |
| { | ||
| var mergedData = MergeData(element, filteredQuery, isPopping); | ||
|
|
||
| //if we are pop or navigating back, we need to apply the query attributes to the ShellContent |
Copilot
AI
Dec 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment on line 315 says "if we are pop or navigating back", but the condition on line 316 only checks isPopping. The comment should be more precise: "if we are popping, we need to apply the query attributes to the ShellContent" or the condition should be updated if it's intended to handle other navigation-back scenarios.
| //if we are pop or navigating back, we need to apply the query attributes to the ShellContent | |
| //if we are popping, we need to apply the query attributes to the ShellContent |
| return; | ||
| } | ||
|
|
||
| if( query.Count > 0) |
Copilot
AI
Dec 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation: this line has extra leading spaces. Should align with the surrounding code using consistent tab indentation.
| if( query.Count > 0) | |
| if( query.Count > 0) |
| return; | ||
| } | ||
|
|
||
| if( query.Count > 0) |
Copilot
AI
Dec 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing space after if keyword. Should be if (query.Count > 0) for consistency with C# formatting conventions.
| if( query.Count > 0) | |
| if (query.Count > 0) |
|
/rebase |
Added unit tests to validate the fix for issues #13537 and #28453: - TabBarNavigationSetsQueryAttributesProperty: Verifies QueryAttributesProperty is set when switching tabs - TabBarNavigationWithGoToAsyncSetsQueryAttributesProperty: Verifies GoToAsync navigation sets property - FlyoutItemNavigationSetsQueryAttributesProperty: Verifies FlyoutItem navigation triggers ApplyQueryAttributes - NavigatingBackToTabSetsQueryAttributesProperty: Verifies navigating back to a tab sets property - PopNavigationTriggersApplyQueryAttributes: Verifies pop navigation restores parameters - ShellSectionChangedSetsQueryAttributesProperty: Verifies ShellSection changes trigger ApplyQueryAttributes These tests ensure IQueryAttributable.ApplyQueryAttributes is called for all Shell navigation types.
…tes (#33006) Added unit tests to validate the fix for issues #13537 and #28453: - TabBarNavigationSetsQueryAttributesProperty: Verifies QueryAttributesProperty is set when switching tabs - TabBarNavigationWithGoToAsyncSetsQueryAttributesProperty: Verifies GoToAsync navigation sets property - FlyoutItemNavigationSetsQueryAttributesProperty: Verifies FlyoutItem navigation triggers ApplyQueryAttributes - NavigatingBackToTabSetsQueryAttributesProperty: Verifies navigating back to a tab sets property - PopNavigationTriggersApplyQueryAttributes: Verifies pop navigation restores parameters - ShellSectionChangedSetsQueryAttributesProperty: Verifies ShellSection changes trigger ApplyQueryAttributes These tests ensure IQueryAttributable.ApplyQueryAttributes is called for all Shell navigation types.
…tes (#33006) Added unit tests to validate the fix for issues #13537 and #28453: - TabBarNavigationSetsQueryAttributesProperty: Verifies QueryAttributesProperty is set when switching tabs - TabBarNavigationWithGoToAsyncSetsQueryAttributesProperty: Verifies GoToAsync navigation sets property - FlyoutItemNavigationSetsQueryAttributesProperty: Verifies FlyoutItem navigation triggers ApplyQueryAttributes - NavigatingBackToTabSetsQueryAttributesProperty: Verifies navigating back to a tab sets property - PopNavigationTriggersApplyQueryAttributes: Verifies pop navigation restores parameters - ShellSectionChangedSetsQueryAttributesProperty: Verifies ShellSection changes trigger ApplyQueryAttributes These tests ensure IQueryAttributable.ApplyQueryAttributes is called for all Shell navigation types.
…tes (#33006) Added unit tests to validate the fix for issues #13537 and #28453: - TabBarNavigationSetsQueryAttributesProperty: Verifies QueryAttributesProperty is set when switching tabs - TabBarNavigationWithGoToAsyncSetsQueryAttributesProperty: Verifies GoToAsync navigation sets property - FlyoutItemNavigationSetsQueryAttributesProperty: Verifies FlyoutItem navigation triggers ApplyQueryAttributes - NavigatingBackToTabSetsQueryAttributesProperty: Verifies navigating back to a tab sets property - PopNavigationTriggersApplyQueryAttributes: Verifies pop navigation restores parameters - ShellSectionChangedSetsQueryAttributesProperty: Verifies ShellSection changes trigger ApplyQueryAttributes These tests ensure IQueryAttributable.ApplyQueryAttributes is called for all Shell navigation types.
…tes (#33006) Added unit tests to validate the fix for issues #13537 and #28453: - TabBarNavigationSetsQueryAttributesProperty: Verifies QueryAttributesProperty is set when switching tabs - TabBarNavigationWithGoToAsyncSetsQueryAttributesProperty: Verifies GoToAsync navigation sets property - FlyoutItemNavigationSetsQueryAttributesProperty: Verifies FlyoutItem navigation triggers ApplyQueryAttributes - NavigatingBackToTabSetsQueryAttributesProperty: Verifies navigating back to a tab sets property - PopNavigationTriggersApplyQueryAttributes: Verifies pop navigation restores parameters - ShellSectionChangedSetsQueryAttributesProperty: Verifies ShellSection changes trigger ApplyQueryAttributes These tests ensure IQueryAttributable.ApplyQueryAttributes is called for all Shell navigation types.
…tes (#33006) Added unit tests to validate the fix for issues #13537 and #28453: - TabBarNavigationSetsQueryAttributesProperty: Verifies QueryAttributesProperty is set when switching tabs - TabBarNavigationWithGoToAsyncSetsQueryAttributesProperty: Verifies GoToAsync navigation sets property - FlyoutItemNavigationSetsQueryAttributesProperty: Verifies FlyoutItem navigation triggers ApplyQueryAttributes - NavigatingBackToTabSetsQueryAttributesProperty: Verifies navigating back to a tab sets property - PopNavigationTriggersApplyQueryAttributes: Verifies pop navigation restores parameters - ShellSectionChangedSetsQueryAttributesProperty: Verifies ShellSection changes trigger ApplyQueryAttributes These tests ensure IQueryAttributable.ApplyQueryAttributes is called for all Shell navigation types.
…tes (#33006) Added unit tests to validate the fix for issues #13537 and #28453: - TabBarNavigationSetsQueryAttributesProperty: Verifies QueryAttributesProperty is set when switching tabs - TabBarNavigationWithGoToAsyncSetsQueryAttributesProperty: Verifies GoToAsync navigation sets property - FlyoutItemNavigationSetsQueryAttributesProperty: Verifies FlyoutItem navigation triggers ApplyQueryAttributes - NavigatingBackToTabSetsQueryAttributesProperty: Verifies navigating back to a tab sets property - PopNavigationTriggersApplyQueryAttributes: Verifies pop navigation restores parameters - ShellSectionChangedSetsQueryAttributesProperty: Verifies ShellSection changes trigger ApplyQueryAttributes These tests ensure IQueryAttributable.ApplyQueryAttributes is called for all Shell navigation types.
…tes (#33006) Added unit tests to validate the fix for issues #13537 and #28453: - TabBarNavigationSetsQueryAttributesProperty: Verifies QueryAttributesProperty is set when switching tabs - TabBarNavigationWithGoToAsyncSetsQueryAttributesProperty: Verifies GoToAsync navigation sets property - FlyoutItemNavigationSetsQueryAttributesProperty: Verifies FlyoutItem navigation triggers ApplyQueryAttributes - NavigatingBackToTabSetsQueryAttributesProperty: Verifies navigating back to a tab sets property - PopNavigationTriggersApplyQueryAttributes: Verifies pop navigation restores parameters - ShellSectionChangedSetsQueryAttributesProperty: Verifies ShellSection changes trigger ApplyQueryAttributes These tests ensure IQueryAttributable.ApplyQueryAttributes is called for all Shell navigation types.
…tes (#33006) Added unit tests to validate the fix for issues #13537 and #28453: - TabBarNavigationSetsQueryAttributesProperty: Verifies QueryAttributesProperty is set when switching tabs - TabBarNavigationWithGoToAsyncSetsQueryAttributesProperty: Verifies GoToAsync navigation sets property - FlyoutItemNavigationSetsQueryAttributesProperty: Verifies FlyoutItem navigation triggers ApplyQueryAttributes - NavigatingBackToTabSetsQueryAttributesProperty: Verifies navigating back to a tab sets property - PopNavigationTriggersApplyQueryAttributes: Verifies pop navigation restores parameters - ShellSectionChangedSetsQueryAttributesProperty: Verifies ShellSection changes trigger ApplyQueryAttributes These tests ensure IQueryAttributable.ApplyQueryAttributes is called for all Shell navigation types.
…tes (#33006) Added unit tests to validate the fix for issues #13537 and #28453: - TabBarNavigationSetsQueryAttributesProperty: Verifies QueryAttributesProperty is set when switching tabs - TabBarNavigationWithGoToAsyncSetsQueryAttributesProperty: Verifies GoToAsync navigation sets property - FlyoutItemNavigationSetsQueryAttributesProperty: Verifies FlyoutItem navigation triggers ApplyQueryAttributes - NavigatingBackToTabSetsQueryAttributesProperty: Verifies navigating back to a tab sets property - PopNavigationTriggersApplyQueryAttributes: Verifies pop navigation restores parameters - ShellSectionChangedSetsQueryAttributesProperty: Verifies ShellSection changes trigger ApplyQueryAttributes These tests ensure IQueryAttributable.ApplyQueryAttributes is called for all Shell navigation types.
## CollectionView - Fixed the NRE in CarouselViewController on iOS 15.5 & 16.4 by @Ahamed-Ali in #30838 <details> <summary>🔧 Fixes</summary> - [NRE in CarouselViewController on iOS 15.5 & 16.4](#28557) </details> - [iOS, macOS] Fixed CollectionView group header size changes with ItemSizingStrategy by @NanthiniMahalingam in #33161 <details> <summary>🔧 Fixes</summary> - [[NET 10] I6_Grouping - Grouping_with_variable_sized_items changing the 'ItemSizingStrategy' also changes the header size.](#33130) </details> ## Flyout - Add unit tests for TabBar and FlyoutItem navigation ApplyQueryAttributes (#25663) by @StephaneDelcroix in #33006 ## Flyoutpage - Fixed the FlyoutPage.Flyout Disappearing When Maximizing the Window on Mac Platform by @NanthiniMahalingam in #26701 <details> <summary>🔧 Fixes</summary> - [FlyoutPage.Flyout - navigation corrupted when running om mac , on window ok](#22719) </details> ## Mediapicker - [Windows] Fix for PickPhotosAsync throws exception if image is modified by @HarishwaranVijayakumar in #32952 <details> <summary>🔧 Fixes</summary> - [PickPhotosAsync throws exception if image is modified.](#32408) </details> ## Navigation - Fix for TabBar Navigation does not invoke its IQueryAttributable.ApplyQueryAttributes(query) by @SuthiYuvaraj in #25663 <details> <summary>🔧 Fixes</summary> - [Tabs defined in AppShell.xaml does not invoke its view model's IQueryAttributable.ApplyQueryAttributes(query) implementaion](#13537) - [`ShellContent` routes do not call `ApplyQueryAttributes`](#28453) </details> ## ScrollView - Fix ScrollToPosition.Center behavior in ScrollView on iOS and MacCatalyst by @devanathan-vaithiyanathan in #26825 <details> <summary>🔧 Fixes</summary> - [ScrollToPosition.Center Centers the First Item too in iOS and Catalyst](#26760) - [On iOS - ScrollView.ScrollToAsync Element, ScrollToPosition.MakeVisible shifts view to the right, instead of just scrolling vertically](#28965) </details> ## Searchbar - [iOS, Mac, Windows] Fixed CharacterSpacing for SearchBar text and placeholder text by @Dhivya-SF4094 in #30407 <details> <summary>🔧 Fixes</summary> - [[iOS, Mac, Windows] SearchBar CharacterSpacing property is not working as expected](#30366) </details> ## Shell - Update logic for large title display mode on iOS - shell by @kubaflo in #33039 ## TitleView - [iOS] Fixed memory leak with PopToRootAsync when using TitleView by @Vignesh-SF3580 in #28547 <details> <summary>🔧 Fixes</summary> - [NavigationPage.TitleView causes memory leak with PopToRootAsync](#28201) </details> ## Xaml - [C] Fix binding to interface-inherited properties like IReadOnlyList<T>.Count by @StephaneDelcroix in #32912 <details> <summary>🔧 Fixes</summary> - [Compiled Binding to Array.Count provides no result](#13872) </details> - Fix #31939: CommandParameter TemplateBinding lost during reparenting by @StephaneDelcroix in #32961 <details> <summary>🔧 Fixes</summary> - [CommandParameter TemplateBinding Lost During ControlTemplate Reparenting](#31939) </details> <details> <summary>🧪 Testing (4)</summary> - [Testing] Fixed Test case failure in PR 33185 - [12/22/2025] Candidate by @TamilarasanSF4853 in #33257 - [Testing] Re-saved ShouldFlyoutBeVisibleAfterMaximizingWindow test case images in PR 33185 - [12/22/2025] Candidate by @TamilarasanSF4853 in #33271 - [Testing] Fixed Test case failure in PR 33185 - [12/22/2025] Candidate - 2 by @TamilarasanSF4853 in #33299 - [Testing] Fixed Test case failure in PR 33185 - [12/22/2025] Candidate - 3 by @TamilarasanSF4853 in #33311 </details> <details> <summary>📦 Other (2)</summary> - [XSG][BindingSourceGen] Add support for RelayCommand to compiled bindings by @simonrozsival via @Copilot in #32954 <details> <summary>🔧 Fixes</summary> - [Issue #25818](#25818) </details> - Revert "Update logic for large title display mode on iOS - shell (#33039)" in cff7f35 </details> **Full Changelog**: main...inflight/candidate
Summary
Adds unit tests to complement PR #25663 which fixes issues #13537 and #28453.
Tests Added
TabBarNavigationSetsQueryAttributesProperty: Verifies QueryAttributesProperty is set when switching tabsTabBarNavigationWithGoToAsyncSetsQueryAttributesProperty: Verifies GoToAsync navigation sets propertyFlyoutItemNavigationSetsQueryAttributesProperty: Verifies FlyoutItem navigation triggers ApplyQueryAttributesNavigatingBackToTabSetsQueryAttributesProperty: Verifies navigating back to a tab sets propertyPopNavigationTriggersApplyQueryAttributes: Verifies pop navigation restores parametersShellSectionChangedSetsQueryAttributesProperty: Verifies ShellSection changes trigger ApplyQueryAttributesThese tests ensure
IQueryAttributable.ApplyQueryAttributesis called for all Shell navigation types.Related PRs
Issues Fixed
ShellContentroutes do not callApplyQueryAttributes#28453