Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
        }