} catch (NullPointerException e) {
// Expected
}
DivElement root = renderer.getRoot(docDiv);
SpanElement nameSpan = renderer.getNameSpan(docDiv);
// remove nameSpan
nameSpan.removeFromParent();
try {
renderer.getNameSpan(docDiv);
fail("Expected IllegalStateException because nameSpan was removed");
} catch (IllegalStateException e) {
// In dev mode this is different from not being attached
assertFalse(GWT.isProdMode());
} catch (IllegalArgumentException e) {
// Otherwise the same error as being not attached
assertTrue(GWT.isProdMode());
}
// Add a a sibling to the root element and remove the root from the parent altogether
SpanElement spanElement = Document.get().createSpanElement();
docDiv.appendChild(spanElement);
root.removeFromParent();
assertFalse(renderer.isParentOrRenderer(docDiv));
if (GWT.isProdMode()) {
// In prod mode no attempt is made to check whether root is still attached
assertTrue(renderer.isParentOrRenderer(root));
} else {
assertFalse(renderer.isParentOrRenderer(root));
}
try {
renderer.getRoot(docDiv);
fail("Expected an IllegalArgumentException to fail because parent does not contain the root");
} catch (IllegalArgumentException e) {
// Expected
}
try {
renderer.getNameSpan(docDiv);
fail("Expected an IllegalArgumentException to fail because parent does not contain the root");
} catch (IllegalArgumentException e) {
// Expected
}
// Finally remove the spanElement too
spanElement.removeFromParent();
assertFalse(renderer.isParentOrRenderer(docDiv));
try {
renderer.getRoot(docDiv);
fail("Expected an IllegalArgumentException to fail because parent does not contain the root");