Browse Source

Add test to check if popup is displayed correctly after window is shown

Przemysław Onak 5 years ago
parent
commit
db98c340d6
1 changed files with 16 additions and 1 deletions
  1. 16 1
      tests/Avalonia.Controls.UnitTests/Primitives/PopupTests.cs

+ 16 - 1
tests/Avalonia.Controls.UnitTests/Primitives/PopupTests.cs

@@ -21,7 +21,22 @@ namespace Avalonia.Controls.UnitTests.Primitives
     public class PopupTests
     {
         protected bool UsePopupHost;
-        
+
+        [Fact]
+        public void Popup_Open_Without_Target_Should_Attach_Itself_Later()
+        {
+            using (CreateServices())
+            {
+                int openedEvent = 0;
+                var target = new Popup();
+                target.Opened += (s, a) => openedEvent++;
+                target.IsOpen = true;
+
+                var window = PreparedWindow(target);
+                window.Show();
+                Assert.Equal(1, openedEvent);
+            }
+        }
 
         [Fact]
         public void Popup_Without_TopLevel_Shouldnt_Call_Open()