// Arrange
final Anchor a0 = new Anchor();
a0.setText("a0");
final Anchor a1 = new Anchor();
a1.setText("a1");
final StackPanel panel = new StackPanel() {
@Override
public void onBrowserEvent(com.google.gwt.user.client.Event event) {
super.onBrowserEvent(event);
if (DOM.eventGetType(event) == Event.ONCLICK) {
tested = !tested;
assertNull(event.getRelatedEventTarget());
}
assertEquals(a1.getElement(), event.getEventTarget());
};
};
panel.add(a0);
panel.insert(a1, 1);
// Act
Browser.click(panel, 1);
// Assert
assertThat(tested).isTrue();
assertThat(panel.getSelectedIndex()).isEqualTo(1);
}