use of ol.Collection.Event in project gwt-ol3 by TDesjardins.
the class CollectionTest method testCollectionEvents.
public void testCollectionEvents() {
this.injectUrlAndTest(() -> {
Collection<Control> controls = new Collection<Control>();
assertFalse(this.elementAddedEventFired);
assertFalse(this.elementRemovedEventFired);
controls.addElementAddedListener(new EventListener<Collection.Event<Control>>() {
@Override
public void onEvent(Event<Control> event) {
elementAddedEventFired = true;
}
});
controls.addElementRemovedListener(new EventListener<Collection.Event<Control>>() {
@Override
public void onEvent(Event<Control> event) {
elementRemovedEventFired = true;
}
});
controls.push(new Attribution());
assertTrue(this.elementAddedEventFired);
assertFalse(this.elementRemovedEventFired);
controls.removeAt(0);
assertTrue(this.elementAddedEventFired);
assertTrue(this.elementRemovedEventFired);
});
}
Aggregations