use of com.vaadin.flow.internal.ConstantPoolKey in project flow by vaadin.
the class DomEventTest method getEventSettings.
private <T extends ComponentEvent<Component>> JsonObject getEventSettings(Class<T> eventType) {
Component component = new Component(new Element("element")) {
};
component.addListener(eventType, e -> {
});
ElementListenerMap elementListenerMap = component.getElement().getNode().getFeature(ElementListenerMap.class);
List<NodeChange> changes = new ArrayList<>();
elementListenerMap.collectChanges(changes::add);
Assert.assertEquals(1, changes.size());
MapPutChange change = (MapPutChange) changes.get(0);
Assert.assertEquals("event", change.getKey());
ConstantPoolKey value = (ConstantPoolKey) change.getValue();
JsonObject constantPoolUpdate = Json.createObject();
value.export(constantPoolUpdate);
String[] keys = constantPoolUpdate.keys();
Assert.assertEquals(1, keys.length);
JsonObject eventSettings = constantPoolUpdate.getObject(keys[0]);
return eventSettings;
}
Aggregations