Esempio n. 1
0
        public void Clicking_On_Control_Toggles_IsDropDownOpen()
        {
            var target = new ComboBox
            {
                Items = new[] { "Foo", "Bar" },
            };

            _helper.Down(target);
            _helper.Up(target);
            Assert.True(target.IsDropDownOpen);

            _helper.Down(target);
            _helper.Up(target);

            Assert.False(target.IsDropDownOpen);
        }
Esempio n. 2
0
        public void Cancel_Light_Dismiss_Closing_Keeps_Flyout_Open()
        {
            using (Application())
            {
                popupImpl.Setup(x => x.Show(true, false)).Verifiable();
                popupImpl.Setup(x => x.Hide()).Verifiable();

                var window = PreparedWindow();
                window.Width  = 100;
                window.Height = 100;

                var button = new Button
                {
                    Height = 10,
                    Width  = 10,
                    HorizontalAlignment = Layout.HorizontalAlignment.Left,
                    VerticalAlignment   = Layout.VerticalAlignment.Top
                };
                window.Content = button;

                window.ApplyTemplate();
                window.Show();

                var tracker = 0;

                var c = new ContextMenu();
                c.ContextMenuClosing += (s, e) =>
                {
                    tracker++;
                    e.Cancel = true;
                };
                button.ContextMenu = c;
                c.Open(button);

                var overlay = LightDismissOverlayLayer.GetLightDismissOverlayLayer(window);
                _mouse.Down(overlay, MouseButton.Left, new Point(90, 90));
                _mouse.Up(button, MouseButton.Left, new Point(90, 90));

                Assert.Equal(1, tracker);
                Assert.True(c.IsOpen);

                popupImpl.Verify(x => x.Hide(), Times.Never);
                popupImpl.Verify(x => x.Show(true, false), Times.Exactly(1));
            }
        }