-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Fix TabbedPage title displaying incorrectly #17039
Changes from 3 commits
41ba1dc
547da58
b7effe9
413a3a0
1fc350b
0efcfa4
3eed94c
091139f
9f7204b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -117,6 +117,43 @@ public async Task ToolbarTitle() | |
}); | ||
} | ||
|
||
[Fact(DisplayName = "Toolbar Uses TabbedPage Title When Set")] | ||
public async Task ToolbarTabbedPageTitle() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's alright to remove these. We have tests that validate that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, removed and added more tests validating the title changing tabs etc. |
||
{ | ||
SetupBuilder(); | ||
var navPage = new NavigationPage( | ||
new TabbedPage | ||
{ | ||
Title = "Tabbed Page Title", | ||
Children = { new ContentPage { Title = "Child Page Title" } }, | ||
}); | ||
|
||
await CreateHandlerAndAddToWindow<WindowHandlerStub>(new Window(navPage), (handler) => | ||
{ | ||
string title = GetToolbarTitle(handler); | ||
Assert.Equal("Tabbed Page Title", title); | ||
return Task.CompletedTask; | ||
}); | ||
} | ||
|
||
[Fact(DisplayName = "Toolbar Uses TabbedPage Child Title")] | ||
public async Task ToolbarTabbedPageChildTitle() | ||
{ | ||
SetupBuilder(); | ||
var navPage = new NavigationPage( | ||
new TabbedPage | ||
{ | ||
Children = { new ContentPage { Title = "Child Page Title" } }, | ||
}); | ||
|
||
await CreateHandlerAndAddToWindow<WindowHandlerStub>(new Window(navPage), (handler) => | ||
{ | ||
string title = GetToolbarTitle(handler); | ||
Assert.Equal("Child Page Title", title); | ||
return Task.CompletedTask; | ||
}); | ||
} | ||
|
||
[Theory] | ||
[InlineData($"{nameof(FlyoutPage)}WithNavigationPage, {nameof(ContentPage)}, {nameof(FlyoutPage)}WithNavigationPage")] | ||
[InlineData($"{nameof(FlyoutPage)}WithNavigationPage, {nameof(FlyoutPage)}, {nameof(FlyoutPage)}WithNavigationPage")] | ||
|
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.
I wonder if this needs to check the page type at all.
I'm testing a few variations of pages on Xamarin.Forms, and the Title always seems to just be whatever the current page is on the navigation page.
Is there ever a scenario where
_currentNavigationPage.CurrentPage.Title isn't what we want here?
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.
I think
_currentNavigationPage.CurrentPage.Title
should be the correct value in all scenarios.