Пример #1
0
        public virtual void HasAssociatedControls()
        {
            //"button", "fieldset", "input", "keygen", "object", "output", "select", "textarea"
            String html = "<form id=1><button id=1><fieldset id=2 /><input id=3><keygen id=4><object id=5><output id=6>"
                          + "<select id=7><option></select><textarea id=8><p id=9>";
            Document    doc  = iText.StyledXmlParser.Jsoup.Jsoup.Parse(html);
            FormElement form = (FormElement)doc.Select("form").First();

            NUnit.Framework.Assert.AreEqual(8, form.Elements().Count);
        }
Пример #2
0
        public virtual void FormsAddedAfterParseAreFormElements()
        {
            Document doc = iText.StyledXmlParser.Jsoup.Jsoup.Parse("<body />");

            doc.Body().Html("<form action='http://example.com/search'><input name='q' value='search'>");
            iText.StyledXmlParser.Jsoup.Nodes.Element formEl = doc.Select("form").First();
            NUnit.Framework.Assert.IsTrue(formEl is FormElement);
            FormElement form = (FormElement)formEl;

            NUnit.Framework.Assert.AreEqual(1, form.Elements().Count);
        }
Пример #3
0
        public virtual void ControlsAddedAfterParseAreLinkedWithForms()
        {
            Document doc = iText.StyledXmlParser.Jsoup.Jsoup.Parse("<body />");

            doc.Body().Html("<form />");
            iText.StyledXmlParser.Jsoup.Nodes.Element formEl = doc.Select("form").First();
            formEl.Append("<input name=foo value=bar>");
            NUnit.Framework.Assert.IsTrue(formEl is FormElement);
            FormElement form = (FormElement)formEl;

            NUnit.Framework.Assert.AreEqual(1, form.Elements().Count);
            IList <KeyVal> data = form.FormData();

            NUnit.Framework.Assert.AreEqual("foo=bar", data[0].ToString());
        }