Query parameters were not being applied during simple navigation (#9348) fixes #9344

This commit is contained in:
Shane Neuville 2020-01-29 04:52:52 -07:00 коммит произвёл GitHub
Родитель 271e41c166
Коммит 74db7f1c74
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 38 добавлений и 20 удалений

Просмотреть файл

@ -284,32 +284,41 @@ namespace Xamarin.Forms.Core.UnitTests
Assert.IsFalse(page1.Appearing);
Assert.IsTrue(page2.Appearing);
}
public class ModalTestPage : ShellLifeCycleTests.LifeCyclePage
[Test]
public async Task BasicQueryStringTest()
{
public ModalTestPage()
var shell = new Shell();
var item = CreateShellItem(shellSectionRoute: "section2");
shell.Items.Add(item);
await shell.GoToAsync(new ShellNavigationState($"ModalTestPage?{nameof(ShellTestPage.SomeQueryParameter)}=1234"));
var testPage = (shell.CurrentItem.CurrentItem as IShellSectionController).PresentedPage as ModalTestPageBase;
Assert.AreEqual("1234", testPage.SomeQueryParameter);
}
[QueryProperty("SomeQueryParameter", "SomeQueryParameter")]
public class ModalTestPageBase : ShellLifeCycleTests.LifeCyclePage
{
public string SomeQueryParameter
{
Shell.SetPresentationMode(this, PresentationMode.Modal);
get;
set;
}
protected override void OnAppearing()
public ModalTestPageBase()
{
base.OnAppearing();
Shell.SetPresentationMode(this, PresentationMode.Modal);
}
}
public class ModalTestPage2 : ShellLifeCycleTests.LifeCyclePage
public class ModalTestPage : ModalTestPageBase
{
public ModalTestPage2()
{
Shell.SetPresentationMode(this, PresentationMode.Modal);
}
}
protected override void OnAppearing()
{
base.OnAppearing();
}
public class ModalTestPage2 : ModalTestPageBase
{
}
public class ModalNavigationTestPage : NavigationPage
@ -318,11 +327,6 @@ namespace Xamarin.Forms.Core.UnitTests
{
Shell.SetPresentationMode(this, PresentationMode.Modal);
}
protected override void OnAppearing()
{
base.OnAppearing();
}
}
public class SomeCustomPage : Page

Просмотреть файл

@ -391,6 +391,19 @@ namespace Xamarin.Forms.Core.UnitTests
Assert.AreEqual("4321", testPage.SomeQueryParameter);
}
[Test]
public async Task BasicQueryStringTest()
{
var shell = new Shell();
var item = CreateShellItem(shellSectionRoute: "section2");
Routing.RegisterRoute("details", typeof(ShellTestPage));
shell.Items.Add(item);
await shell.GoToAsync(new ShellNavigationState($"details?{nameof(ShellTestPage.SomeQueryParameter)}=1234"));
var testPage = (shell.CurrentItem.CurrentItem as IShellSectionController).PresentedPage as ShellTestPage;
Assert.AreEqual("1234", testPage.SomeQueryParameter);
}
[Test]
public async Task NavigationWithQueryStringAndNoDataTemplate()

Просмотреть файл

@ -406,6 +406,7 @@ namespace Xamarin.Forms
var isModal = (Shell.GetPresentationMode(content) & PresentationMode.Modal) == PresentationMode.Modal;
Shell.ApplyQueryAttributes(content, queryData, isLast);
if (isModal)
{
modalPageStacks.Add(content);