Search in sources :

Example 6 with ClientDelegateHandlers

use of com.vaadin.flow.internal.nodefeature.ClientDelegateHandlers in project flow by vaadin.

the class ClientDelegteHandlersTest method eventHandlersUnrelatedToAttach.

@Test
public void eventHandlersUnrelatedToAttach() {
    StateNode stateNode = new StateNode(ComponentMapping.class, ClientDelegateHandlers.class);
    stateNode.getFeature(ComponentMapping.class).setComponent(new Template1());
    ClientDelegateHandlers feature = stateNode.getFeature(ClientDelegateHandlers.class);
    Assert.assertEquals(1, feature.size());
}
Also used : ClientDelegateHandlers(com.vaadin.flow.internal.nodefeature.ClientDelegateHandlers) StateNode(com.vaadin.flow.internal.StateNode) ComponentMapping(com.vaadin.flow.internal.nodefeature.ComponentMapping) Test(org.junit.Test)

Example 7 with ClientDelegateHandlers

use of com.vaadin.flow.internal.nodefeature.ClientDelegateHandlers in project flow by vaadin.

the class ClientDelegteHandlersTest method nonTemplateComponentWithoutEventHandler.

@Test
public void nonTemplateComponentWithoutEventHandler() {
    UI ui = new UI();
    NonTemplateComponentWithoutEventHandler component = new NonTemplateComponentWithoutEventHandler();
    ui.add(component);
    ClientDelegateHandlers feature = component.getElement().getNode().getFeature(ClientDelegateHandlers.class);
    assertListFeature(feature);
}
Also used : UI(com.vaadin.flow.component.UI) ClientDelegateHandlers(com.vaadin.flow.internal.nodefeature.ClientDelegateHandlers) Test(org.junit.Test)

Example 8 with ClientDelegateHandlers

use of com.vaadin.flow.internal.nodefeature.ClientDelegateHandlers in project flow by vaadin.

the class ClientDelegteHandlersTest method attach_handlersContainsOnlyOneTemplateMethod.

@Test
public void attach_handlersContainsOnlyOneTemplateMethod() {
    UI ui = new UI();
    AngularTemplate template = new ChildTemplateWithOverriddenMethod();
    ui.add(template);
    ClientDelegateHandlers feature = template.getElement().getNode().getFeature(ClientDelegateHandlers.class);
    Assert.assertEquals(1, feature.size());
    Assert.assertEquals(getDeclaredMethods(ChildTemplateWithOverriddenMethod.class).findFirst().get(), feature.get(0));
}
Also used : UI(com.vaadin.flow.component.UI) AngularTemplate(com.vaadin.flow.template.angular.AngularTemplate) ClientDelegateHandlers(com.vaadin.flow.internal.nodefeature.ClientDelegateHandlers) Test(org.junit.Test)

Aggregations

ClientDelegateHandlers (com.vaadin.flow.internal.nodefeature.ClientDelegateHandlers)8 Test (org.junit.Test)8 UI (com.vaadin.flow.component.UI)7 AngularTemplate (com.vaadin.flow.template.angular.AngularTemplate)5 StateNode (com.vaadin.flow.internal.StateNode)1 ComponentMapping (com.vaadin.flow.internal.nodefeature.ComponentMapping)1