|
|
@ -13,6 +13,7 @@ using Moq; |
|
|
using Xunit; |
|
|
using Xunit; |
|
|
using System.ComponentModel; |
|
|
using System.ComponentModel; |
|
|
using System.Runtime.CompilerServices; |
|
|
using System.Runtime.CompilerServices; |
|
|
|
|
|
using Avalonia.UnitTests; |
|
|
|
|
|
|
|
|
namespace Avalonia.Markup.Xaml.UnitTests.Data |
|
|
namespace Avalonia.Markup.Xaml.UnitTests.Data |
|
|
{ |
|
|
{ |
|
|
@ -337,6 +338,28 @@ namespace Avalonia.Markup.Xaml.UnitTests.Data |
|
|
Assert.Equal("foo", target.Content); |
|
|
Assert.Equal("foo", target.Content); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
[Fact] |
|
|
|
|
|
public void Binding_With_Null_Path_Works() |
|
|
|
|
|
{ |
|
|
|
|
|
using (UnitTestApplication.Start(TestServices.StyledWindow)) |
|
|
|
|
|
{ |
|
|
|
|
|
var xaml = @"
|
|
|
|
|
|
<Window xmlns='https://github.com/avaloniaui'
|
|
|
|
|
|
xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'
|
|
|
|
|
|
xmlns:local='clr-namespace:Avalonia.Markup.Xaml.UnitTests.Xaml;assembly=Avalonia.Markup.Xaml.UnitTests'> |
|
|
|
|
|
<TextBlock Name='textBlock' Text='{Binding}'/> |
|
|
|
|
|
</Window>";
|
|
|
|
|
|
var loader = new AvaloniaXamlLoader(); |
|
|
|
|
|
var window = (Window)loader.Load(xaml); |
|
|
|
|
|
var textBlock = window.FindControl<TextBlock>("textBlock"); |
|
|
|
|
|
|
|
|
|
|
|
window.DataContext = "foo"; |
|
|
|
|
|
window.ApplyTemplate(); |
|
|
|
|
|
|
|
|
|
|
|
Assert.Equal("foo", textBlock.Text); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
private class TwoWayBindingTest : Control |
|
|
private class TwoWayBindingTest : Control |
|
|
{ |
|
|
{ |
|
|
public static readonly StyledProperty<string> TwoWayProperty = |
|
|
public static readonly StyledProperty<string> TwoWayProperty = |
|
|
|