public void SelectOptionsRemoveOptionShouldWork() { var document = String.Empty.ToHtmlDocument(); var div = document.CreateElement <IHtmlDivElement>(); var select = document.CreateElement <IHtmlSelectElement>(); div.AppendChild(select); Assert.AreEqual(div, select.Parent); var options = new IHtmlOptionElement[3]; for (int i = 0; i < options.Length; i++) { options[i] = document.CreateElement <IHtmlOptionElement>(); options[i].TextContent = i.ToString(); select.AppendChild(options[i]); } select.Options.Remove(-1); CollectionAssert.AreEqual(options, select.Options); select.Options.Remove(3); CollectionAssert.AreEqual(options, select.Options); select.Options.Remove(0); CollectionAssert.AreEqual(new[] { options[1], options[2] }, select.Options); }
public void SetOptionAt(Int32 index, IHtmlOptionElement value) { var child = GetOptionAt(index); if (child != null) { _parent.ReplaceChild(value, child); } else { _parent.AppendChild(value); } }
public async Task <ISutApp> SelectOnElement(IHtmlOptionElement selectable) { if (selectable == null) { throw new ArgumentNullException(nameof(selectable)); } var type = selectable.GetType(); if (selectable.Value == null) { throw new NotImplementedException($"selectable {type.FullName} is not supported."); } return(this as TApp); }
public void Add(IHtmlOptionElement element, IHtmlElement before = null) { _parent.InsertBefore(element, before); }
public void AddOption(IHtmlOptionElement element, IHtmlElement before = null) { Options.Add(element, before); }
public void Add(IHtmlOptionElement element, IHtmlElement before = null) { _parent.InsertBefore(element, before); }
public void SetOptionAt(Int32 index, IHtmlOptionElement value) { var child = GetOptionAt(index); if (child != null) { _parent.ReplaceChild(value, child); } else { _parent.AppendChild(value); } }
public void SetOptionAt(Int32 index, IHtmlOptionElement value) { _parent.ReplaceChild(value, GetOptionAt(index)); }
/// <summary> /// Adds the element to the options collection. /// </summary> /// <param name="element">The option element to add.</param> /// <param name="before">The following element.</param> public void AddOption(IHtmlOptionElement element, IHtmlElement before = null) { Options.Add(element, before); }
public void SelectOptionsRemoveOptionShouldWork() { var document = String.Empty.ToHtmlDocument(); var div = document.CreateElement<IHtmlDivElement>(); var select = document.CreateElement<IHtmlSelectElement>(); div.AppendChild(select); Assert.AreEqual(div, select.Parent); var options = new IHtmlOptionElement[3]; for (int i = 0; i < options.Length; i++) { options[i] = document.CreateElement<IHtmlOptionElement>(); options[i].TextContent = i.ToString(); select.AppendChild(options[i]); } select.Options.Remove(-1); CollectionAssert.AreEqual(options, select.Options); select.Options.Remove(3); CollectionAssert.AreEqual(options, select.Options); select.Options.Remove(0); CollectionAssert.AreEqual(new[] { options[1], options[2] }, select.Options); }