Search in sources :

Example 1 with TracksAttachDetach

use of com.vaadin.flow.component.ComponentTest.TracksAttachDetach in project flow by vaadin.

the class CompositeTest method setup.

@Before
public void setup() {
    compositeWithComponent = new CompositeWithComponent() {

        @Override
        public String toString() {
            return "Composite";
        }
    };
    layoutWithSingleComponentComposite = new TestLayout() {

        @Override
        public String toString() {
            return "Layout";
        }
    };
    layoutWithSingleComponentComposite.addComponent(compositeWithComponent);
    ((TracksAttachDetach) componentInsideLayoutInsideComposite).track();
    compositeWithComponent.track();
    layoutInsideComposite.track();
    layoutWithSingleComponentComposite.track();
    Assert.assertNull(VaadinService.getCurrent());
    VaadinService service = Mockito.mock(VaadinService.class);
    DeploymentConfiguration configuration = Mockito.mock(DeploymentConfiguration.class);
    Mockito.when(configuration.isProductionMode()).thenReturn(true);
    Mockito.when(service.getDeploymentConfiguration()).thenReturn(configuration);
    VaadinService.setCurrent(service);
}
Also used : VaadinService(com.vaadin.flow.server.VaadinService) TestLayout(com.vaadin.flow.component.CompositeNestedTest.TestLayout) TracksAttachDetach(com.vaadin.flow.component.ComponentTest.TracksAttachDetach) DeploymentConfiguration(com.vaadin.flow.function.DeploymentConfiguration) Before(org.junit.Before)

Aggregations

TracksAttachDetach (com.vaadin.flow.component.ComponentTest.TracksAttachDetach)1 TestLayout (com.vaadin.flow.component.CompositeNestedTest.TestLayout)1 DeploymentConfiguration (com.vaadin.flow.function.DeploymentConfiguration)1 VaadinService (com.vaadin.flow.server.VaadinService)1 Before (org.junit.Before)1