Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@
Grid.Column="1"
Margin="0,0,2,0"
FontSize="{TemplateBinding FontSize}"
IsHitTestVisible="False"
Opacity="{TemplateBinding wpf:HintAssist.HintOpacity}"
Text="{TemplateBinding wpf:TextFieldAssist.PrefixText}"
VerticalAlignment="Center">
Expand Down Expand Up @@ -446,6 +447,7 @@
Grid.Column="3"
Margin="2,0,0,0"
FontSize="{TemplateBinding FontSize}"
IsHitTestVisible="False"
Opacity="{TemplateBinding wpf:HintAssist.HintOpacity}"
Text="{TemplateBinding wpf:TextFieldAssist.SuffixText}"
VerticalAlignment="Center">
Expand Down
35 changes: 35 additions & 0 deletions tests/MaterialDesignThemes.UITests/WPF/ComboBoxes/ComboBoxTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -299,4 +299,39 @@ public async Task ComboBox_UsesDropDownBackgroundResource_WhenBackgroundIsNotSet
await Assert.That(popupBackground).IsNotNull();
await Assert.That(popupBackground).IsEqualTo((Color)ColorConverter.ConvertFromString("#CC336699"));
}

[Test]
[Description("https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/issues/4090")]
public async Task ComboBox_OpensDropDown_WhenClickingOnPrefixOrSuffixTextBlock()
{
var comboBox = await LoadXaml<ComboBox>($"""
<ComboBox materialDesign:TextFieldAssist.PrefixText="Some prefix"
materialDesign:TextFieldAssist.SuffixText="Some suffix"
SelectedIndex="1">
<ComboBoxItem Content="Android" />
<ComboBoxItem Content="iOS" />
<ComboBoxItem Content="Linux" />
<ComboBoxItem Content="Windows" />
</ComboBox>
""");

await Assert.That(await comboBox.GetIsDropDownOpen()).IsFalse();

var prefixTextBlock = await comboBox.GetElement<TextBlock>("PrefixTextBlock");
await AssertOpensAndClosesDropDown(prefixTextBlock);

var suffixTextBlock = await comboBox.GetElement<TextBlock>("SuffixTextBlock");
await AssertOpensAndClosesDropDown(suffixTextBlock);

async Task AssertOpensAndClosesDropDown(IVisualElement<TextBlock> textBlock)
{
await textBlock.LeftClick();
await Task.Delay(50, TestContext.Current!.Execution.CancellationToken);
await Assert.That(await comboBox.GetIsDropDownOpen()).IsTrue();

await textBlock.LeftClick();
await Task.Delay(50, TestContext.Current!.Execution.CancellationToken);
await Assert.That(await comboBox.GetIsDropDownOpen()).IsFalse();
}
}
}
Loading