use of com.vaadin.flow.internal.nodefeature.ClientDelegateHandlers in project flow by vaadin.
the class ClientDelegteHandlersTest method attach_methodHasGoodArg_ExceptionIsThrown.
@Test
public void attach_methodHasGoodArg_ExceptionIsThrown() {
UI ui = new UI();
AngularTemplate template = new TemplateWithGoodParametersMethods();
ui.add(template);
ClientDelegateHandlers feature = template.getElement().getNode().getFeature(ClientDelegateHandlers.class);
Assert.assertEquals(10, feature.size());
Set<String> methods = getDeclaredMethods(TemplateWithGoodParametersMethods.class).collect(Collectors.toCollection(HashSet::new));
methods.add(getDeclaredMethods(Template1.class).findFirst().get());
for (int i = 0; i < feature.size(); i++) {
methods.remove(feature.get(i));
}
Assert.assertTrue("Feature doesn't contain methods: " + methods.toString(), methods.isEmpty());
}
use of com.vaadin.flow.internal.nodefeature.ClientDelegateHandlers in project flow by vaadin.
the class ClientDelegteHandlersTest method nonTemplateComponentWithEventHandler.
@Test
public void nonTemplateComponentWithEventHandler() {
UI ui = new UI();
NonTemplateComponentWithEventHandler component = new NonTemplateComponentWithEventHandler();
ui.add(component);
ClientDelegateHandlers feature = component.getElement().getNode().getFeature(ClientDelegateHandlers.class);
assertListFeature(feature, "publishedMethod1");
}
use of com.vaadin.flow.internal.nodefeature.ClientDelegateHandlers in project flow by vaadin.
the class ClientDelegteHandlersTest method attach_handlersContainsTemplateMethod.
@Test
public void attach_handlersContainsTemplateMethod() {
UI ui = new UI();
AngularTemplate template = new Template1();
ui.add(template);
ClientDelegateHandlers feature = template.getElement().getNode().getFeature(ClientDelegateHandlers.class);
Assert.assertEquals(1, feature.size());
Assert.assertEquals(getDeclaredMethods(Template1.class).findFirst().get(), feature.get(0));
}
use of com.vaadin.flow.internal.nodefeature.ClientDelegateHandlers in project flow by vaadin.
the class ClientDelegteHandlersTest method attach_methodWithUncheckedException_handlersContainsTemplateMethod.
@Test
public void attach_methodWithUncheckedException_handlersContainsTemplateMethod() {
UI ui = new UI();
AngularTemplate template = new TemplateWithMethodDeclaringUncheckedException();
ui.add(template);
ClientDelegateHandlers feature = template.getElement().getNode().getFeature(ClientDelegateHandlers.class);
Assert.assertEquals(2, feature.size());
Assert.assertEquals(getDeclaredMethods(TemplateWithMethodDeclaringUncheckedException.class).findFirst().get(), feature.get(0));
}
use of com.vaadin.flow.internal.nodefeature.ClientDelegateHandlers in project flow by vaadin.
the class ClientDelegteHandlersTest method attach_handlersContainsAllTemplateMethods.
@Test
public void attach_handlersContainsAllTemplateMethods() {
UI ui = new UI();
AngularTemplate template = new ChildTemplateWithMultipleMethods();
ui.add(template);
ClientDelegateHandlers feature = template.getElement().getNode().getFeature(ClientDelegateHandlers.class);
Assert.assertEquals(3, feature.size());
Set<String> methods = getDeclaredMethods(ChildTemplateWithMultipleMethods.class).collect(Collectors.toCollection(HashSet::new));
methods.add(getDeclaredMethods(Template1.class).findFirst().get());
for (int i = 0; i < feature.size(); i++) {
methods.remove(feature.get(i));
}
Assert.assertTrue("Feature doesn't contain methods: " + methods.toString(), methods.isEmpty());
}
Aggregations