diff --git a/tests/Avalonia.Markup.UnitTests/Data/ExpressionObserverTests_SetValue.cs b/tests/Avalonia.Markup.UnitTests/Data/ExpressionObserverTests_SetValue.cs
index 3238435841..0705ae9c5a 100644
--- a/tests/Avalonia.Markup.UnitTests/Data/ExpressionObserverTests_SetValue.cs
+++ b/tests/Avalonia.Markup.UnitTests/Data/ExpressionObserverTests_SetValue.cs
@@ -2,8 +2,8 @@
// Licensed under the MIT license. See licence.md file in the project root for full license information.
using System;
-using System.Collections.Generic;
using System.Reactive.Linq;
+using System.Reactive.Subjects;
using Avalonia.Markup.Data;
using Avalonia.UnitTests;
using Xunit;
@@ -54,6 +54,28 @@ namespace Avalonia.Markup.UnitTests.Data
Assert.False(target.SetValue("foo"));
}
+ ///
+ /// Test for #831 - Bound properties are incorrectly updated when changing tab items.
+ ///
+ ///
+ /// There was a bug whereby pushing a null as the ExpressionObserver root didn't update
+ /// the leaf node, cauing a subsequent SetValue to update an object that should have become
+ /// unbound.
+ ///
+ [Fact]
+ public void Pushing_Null_To_RootObservable_Updates_Leaf_Node()
+ {
+ var data = new Class1 { Foo = new Class2 { Bar = "bar" } };
+ var rootObservable = new BehaviorSubject(data);
+ var target = new ExpressionObserver(rootObservable, "Foo.Bar");
+
+ target.Subscribe(_ => { });
+ rootObservable.OnNext(null);
+ target.SetValue("baz");
+
+ Assert.Equal("bar", data.Foo.Bar);
+ }
+
private class Class1 : NotifyingBase
{
private Class2 _foo;