Browse Source

Added failing batch update test.

pull/5686/head
Steven Kirk 5 years ago
parent
commit
0a41ba08fd
  1. 23
      tests/Avalonia.Base.UnitTests/AvaloniaObjectTests_BatchUpdate.cs

23
tests/Avalonia.Base.UnitTests/AvaloniaObjectTests_BatchUpdate.cs

@ -449,6 +449,29 @@ namespace Avalonia.Base.UnitTests
Assert.Null(raised[1].NewValue);
}
[Fact]
public void Can_Set_Cleared_Value_When_Ending_Batch_Update()
{
var target = new TestClass();
var raised = 0;
target.Foo = "foo";
target.BeginBatchUpdate();
target.ClearValue(TestClass.FooProperty);
target.PropertyChanged += (sender, e) =>
{
if (e.Property == TestClass.FooProperty && e.NewValue is null)
{
target.Foo = "bar";
++raised;
}
};
target.EndBatchUpdate();
Assert.Equal(1, raised);
}
public class TestClass : AvaloniaObject
{
public static readonly StyledProperty<string> FooProperty =

Loading…
Cancel
Save