Skip to content

Commit

Permalink
Added skipped tests for #4496.
Browse files Browse the repository at this point in the history
  • Loading branch information
grokys committed Aug 19, 2020
1 parent 95f9a98 commit c2a1427
Showing 1 changed file with 62 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1089,6 +1089,68 @@ public void Removing_Item_Before_SelectedItem_Should_Update_SelectedIndex()
Assert.Equal("Bar", target.SelectedItem);
}

[Fact(Skip = "We don't handle this properly yet")]
public void Binding_SelectedIndex_Selects_Correct_Item()
{
// Issue #4496 (part 2)
var items = new ObservableCollection<string>();

var other = new ListBox
{
Template = Template(),
Items = items,
SelectionMode = SelectionMode.AlwaysSelected,
};

var target = new ListBox
{
Template = Template(),
Items = items,
[!ListBox.SelectedIndexProperty] = other[!ListBox.SelectedIndexProperty],
};

target.ApplyTemplate();
target.Presenter.ApplyTemplate();
other.ApplyTemplate();
other.Presenter.ApplyTemplate();

items.Add("Foo");

Assert.Equal(0, other.SelectedIndex);
Assert.Equal(0, target.SelectedIndex);
}

[Fact(Skip = "We don't handle this properly yet")]
public void Binding_SelectedItem_Selects_Correct_Item()
{
// Issue #4496 (part 2)
var items = new ObservableCollection<string>();

var other = new ListBox
{
Template = Template(),
Items = items,
SelectionMode = SelectionMode.AlwaysSelected,
};

var target = new ListBox
{
Template = Template(),
Items = items,
[!ListBox.SelectedItemProperty] = other[!ListBox.SelectedItemProperty],
};

target.ApplyTemplate();
target.Presenter.ApplyTemplate();
other.ApplyTemplate();
other.Presenter.ApplyTemplate();

items.Add("Foo");

Assert.Equal(0, other.SelectedIndex);
Assert.Equal(0, target.SelectedIndex);
}

[Fact]
public void Replacing_Selected_Item_Should_Update_SelectedItem()
{
Expand Down

0 comments on commit c2a1427

Please sign in to comment.