@Test
public void testPAnchor() {
// creation
updateUI(new RequestHandler() {
@Override
public void onRequest() {
final PAnchor anchor = new PAnchor("An anchor");
anchor.ensureDebugId("anchor1");
PRootPanel.get().add(anchor);
register(anchor);
}
});
WebElement element = findElementById("anchor1");
Assert.assertEquals("An anchor", element.getText());
// update text
updateUI(new RequestHandler() {
@Override
public void onRequest() {
final PAnchor anchor = get("anchor1");
anchor.setText("New text of the anchor");
}
});
element = findElementById("anchor1");
Assert.assertEquals("New text of the anchor", element.getText());
// update html
updateUI(new RequestHandler() {
@Override
public void onRequest() {
final PAnchor anchor = get("anchor1");
anchor.setHTML("Anchor <font color='red'>with pure html</font>");