public void AddClassIfMissing_AlreadyThere_LeavesAlone() { var dom = new XmlDocument(); dom.LoadXml(@"<div class='one two three'/>"); HtmlDom.AddClassIfMissing((XmlElement)dom.FirstChild, "two"); AssertThatXmlIn.Dom(dom).HasSpecifiedNumberOfMatchesForXpath("div[@class='one two three']", 1); }
public void AddClassIfMissing_NoClasses_Adds() { var dom = new XmlDocument(); dom.LoadXml(@"<div class=''/>"); HtmlDom.AddClassIfMissing((XmlElement)dom.FirstChild, "two"); AssertThatXmlIn.Dom(dom).HasSpecifiedNumberOfMatchesForXpath("div[@class='two']", 1); }