use of org.loboevolution.html.node.DocumentType in project LoboEvolution by LoboEvolution.
the class DOMImplementationTest method testCreateDocument3.
@Test
public void testCreateDocument3() {
DocumentType doctype = domImpl.createDocumentType("html", null, null);
assertNull(doctype.getNextSibling());
assertNull(doctype.getPreviousSibling());
Document document = domImpl.createDocument(null, "html", doctype);
assertEquals("CSS1Compat", document.getCompatMode());
Element docelm = document.getDocumentElement();
assertNotNull(docelm);
assertSame(docelm, doctype.getNextSibling());
assertNull(doctype.getPreviousSibling());
assertSame(doctype, docelm.getPreviousSibling());
assertNull(docelm.getNextSibling());
assertSame(document, docelm.getParentNode());
assertSame(document, docelm.getOwnerDocument());
assertSame(document, doctype.getOwnerDocument());
}
use of org.loboevolution.html.node.DocumentType in project LoboEvolution by LoboEvolution.
the class DOMImplementationTest method testCreateDocumentType.
@Test
public void testCreateDocumentType() {
DocumentType doctype = domImpl.createDocumentType("html", null, null);
assertEquals("<!DOCTYPE html>", doctype.toString());
//
doctype = domImpl.createDocumentType("html", "-//W3C//DTD XHTML 1.0 Strict//EN", null);
assertEquals("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\">", doctype.toString());
//
doctype = domImpl.createDocumentType("html", null, "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd");
assertEquals("<!DOCTYPE html SYSTEM \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">", doctype.toString());
//
doctype = domImpl.createDocumentType("html", "-//W3C//DTD XHTML 1.0 Strict//EN", "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd");
assertEquals("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">", doctype.toString());
//
try {
domImpl.createDocumentType("html><html><injection/", null, null);
fail("Must throw exception.");
} catch (DOMException e) {
assertEquals(DOMException.INVALID_CHARACTER_ERR, e.getCode());
}
//
doctype = domImpl.createDocumentType("html", "\"><injection foo=\"", null);
assertEquals("<!DOCTYPE html PUBLIC \""><injection foo="\">", doctype.toString());
//
doctype = domImpl.createDocumentType("html", null, "\"><injection foo=\"");
assertEquals("<!DOCTYPE html SYSTEM \""><injection foo="\">", doctype.toString());
}
use of org.loboevolution.html.node.DocumentType in project LoboEvolution by LoboEvolution.
the class DOMImplementationTest method testCreateDocument2.
@Test
public void testCreateDocument2() {
DocumentType doctype = domImpl.createDocumentType("html", null, null);
assertNull(doctype.getNextSibling());
assertNull(doctype.getPreviousSibling());
assertNull(doctype.getParentNode());
assertNull(doctype.getOwnerDocument());
Document document = domImpl.createDocument(null, null, doctype);
assertNull(doctype.getNextSibling());
assertNull(doctype.getPreviousSibling());
assertSame(document, doctype.getOwnerDocument());
try {
domImpl.createDocument(null, null, doctype);
fail("Must throw an exception");
} catch (DOMException e) {
assertEquals(DOMException.WRONG_DOCUMENT_ERR, e.getCode());
}
}
Aggregations