Skip to content
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: Ensure bindings are set once presenter has owner set #902

Merged
merged 2 commits into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion src/Uno.Toolkit.RuntimeTests/Tests/NavigationBarTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
using Uno.Toolkit.UI;
using Uno.UI.RuntimeTests;
using Windows.System;

using Windows.Foundation;
#if __IOS__
using UIKit;
#endif
Expand Down Expand Up @@ -40,6 +40,23 @@ namespace Uno.Toolkit.RuntimeTests.Tests
[RunsOnUIThread]
internal partial class NavigationBarTests
{
#if !(__ANDROID__ || __IOS__)
[TestMethod]
public async Task NavigationBar_Renders_MainCommand()
{
var mainCommand = new AppBarButton();
var navigationBar = new NavigationBar { Content = "Title", MainCommandMode = MainCommandMode.Action, MainCommand = mainCommand };
var content = new Grid { Children = { navigationBar } };

await UnitTestUIContentHelperEx.SetContentAndWait(content);


Assert.IsTrue(mainCommand.ActualHeight > 0, "MainCommand.ActualHeight is not greater than 0");
Assert.IsTrue(mainCommand.ActualWidth > 0, "MainCommand.ActualWidth is not greater than 0");
}

#endif

[TestMethod]
[DataRow(MainCommandMode.Back, DisplayName = nameof(MainCommandMode.Back))]
[DataRow(MainCommandMode.Action, DisplayName = nameof(MainCommandMode.Action))]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ public void SetOwner(NavigationBar? owner)
return;
}

_weakNavBar = new WeakReference<NavigationBar?>(owner);
_weakNavBar = new WeakReference<NavigationBar?>(owner);
SetBindings();
}
protected override void OnApplyTemplate()
{
Expand Down
Loading