public IEnumerator ShouldDisplayBasedOnOptions([Values(true, false)] bool enableReordering) { listElement = new ListElement(Property, new ListOptions { EnableReordering = enableReordering }); WindowFixture.RootElement.Add(listElement); yield return(null); WindowFixture.RootElement.Remove(listElement); if (listElement.Query(null, UxmlClassNames.MoveItemUpButtonClassName).ToList().Any(x => x.resolvedStyle.display == (enableReordering ? DisplayStyle.None : DisplayStyle.Flex)) || listElement.Query(null, UxmlClassNames.MoveItemDownButtonClassName).ToList().Any(x => x.resolvedStyle.display == (enableReordering ? DisplayStyle.None : DisplayStyle.Flex))) { Assert.Fail( $"Buttons {(enableReordering ? "should" : "shouldn't")} be displayed with option {enableReordering}"); } }
public IEnumerator ShouldCorrectButtonVisibilityBasedOnOption([Values(true, false)] bool option) { listElement = new ListElement(Property, new ListOptions { EnableDeletions = option }); WindowFixture.RootElement.Add(listElement); return(WindowFixture.RootElement.AddAndRemove(listElement, () => { if (ClearButton.resolvedStyle.display == (option ? DisplayStyle.None : DisplayStyle.Flex)) { Assert.Fail($"Clear List button {(option ? "should" : "should not")} be visible"); } if (listElement.Query(null, UxmlClassNames.RemoveItemButtonClassName).ToList().Any(x => x.resolvedStyle.display == (option ? DisplayStyle.None : DisplayStyle.Flex))) { Assert.Fail($"Remove item buttons {(option ? "should" : "should not")} be visible"); } return null; })); }