Exemple #1
0
        public virtual void SupportsClone()
        {
            Document doc = iText.StyledXmlParser.Jsoup.Jsoup.Parse("<div class=foo>Text</div>");

            iText.StyledXmlParser.Jsoup.Nodes.Element el = doc.Select("div").First();
            NUnit.Framework.Assert.IsTrue(el.HasClass("foo"));
            iText.StyledXmlParser.Jsoup.Nodes.Element elClone = ((Document)doc.Clone()).Select("div").First();
            NUnit.Framework.Assert.IsTrue(elClone.HasClass("foo"));
            NUnit.Framework.Assert.IsTrue(elClone.Text().Equals("Text"));
            el.RemoveClass("foo");
            el.Text("None");
            NUnit.Framework.Assert.IsFalse(el.HasClass("foo"));
            NUnit.Framework.Assert.IsTrue(elClone.HasClass("foo"));
            NUnit.Framework.Assert.IsTrue(el.Text().Equals("None"));
            NUnit.Framework.Assert.IsTrue(elClone.Text().Equals("Text"));
        }