Skip to content

Commit

Permalink
fixes MaterialDesignInXAML#3654 set IsTabStop in to False in the defa…
Browse files Browse the repository at this point in the history
…ult NumericUpDown control
  • Loading branch information
corvinsz committed Aug 21, 2024
1 parent 31659be commit 055565a
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
<Setter Property="Padding" Value="{x:Static wpf:Constants.TextBoxDefaultPadding}" />
<Setter Property="BorderThickness" Value="0,0,0,1" />
<Setter Property="MinWidth" Value="100" />
<Setter Property="IsTabStop" Value="False" />
<Setter Property="IncreaseContent" Value="{StaticResource ContentIncrease}" />
<Setter Property="DecreaseContent" Value="{StaticResource ContentDecrease}" />
<Setter Property="Template">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace MaterialDesignThemes.UITests.WPF.NumericUpDowns;
using System.ComponentModel;

namespace MaterialDesignThemes.UITests.WPF.NumericUpDowns;

public class NumericUpDownTests(ITestOutputHelper output) : TestBase(output)
{
Expand Down Expand Up @@ -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<StackPanel>("""
<StackPanel>
<TextBox />
<materialDesign:NumericUpDown />
</StackPanel>
""");

var textBox = await stackPanel.GetElement<TextBox>("/TextBox");
var part_textBox = await stackPanel.GetElement<TextBox>("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();
}
}

0 comments on commit 055565a

Please sign in to comment.