diff --git a/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.NumericUpDown.xaml b/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.NumericUpDown.xaml index b705ad673a..e957468a93 100644 --- a/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.NumericUpDown.xaml +++ b/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.NumericUpDown.xaml @@ -30,6 +30,7 @@ + diff --git a/tests/MaterialDesignThemes.UITests/WPF/NumericUpDowns/NumericUpDownTests.cs b/tests/MaterialDesignThemes.UITests/WPF/NumericUpDowns/NumericUpDownTests.cs index 1378801259..c1d4c528cd 100644 --- a/tests/MaterialDesignThemes.UITests/WPF/NumericUpDowns/NumericUpDownTests.cs +++ b/tests/MaterialDesignThemes.UITests/WPF/NumericUpDowns/NumericUpDownTests.cs @@ -1,4 +1,6 @@ -namespace MaterialDesignThemes.UITests.WPF.NumericUpDowns; +using System.ComponentModel; + +namespace MaterialDesignThemes.UITests.WPF.NumericUpDowns; public class NumericUpDownTests(ITestOutputHelper output) : TestBase(output) { @@ -115,4 +117,34 @@ public async Task MaxAndMinAssignments_CoerceValueToBeInRange() Assert.Equal(3, await numericUpDown.GetMinimum()); Assert.Equal(3, await numericUpDown.GetMaximum()); } + + [Fact] + [Description("Issue 3654")] + public async Task NumericUpDown_InternalTextBoxIsFocused_WhenGettingKeyboardFocus() + { + await using var recorder = new TestRecorder(App); + + // Arrange + var stackPanel = await LoadXaml(""" + + + + + """); + + var textBox = await stackPanel.GetElement("/TextBox"); + var part_textBox = await stackPanel.GetElement("PART_TextBox"); + + // Act + await textBox.MoveKeyboardFocus(); + await Task.Delay(50); + await textBox.SendInput(new KeyboardInput(Key.Tab)); + await Task.Delay(50); + + // Assert + Assert.False(await textBox.GetIsFocused()); + Assert.True(await part_textBox.GetIsFocused()); + + recorder.Success(); + } }