aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/test/java/com/vaadin/tests/design/designroot/CustomComponentDesignRootTest.java
blob: afce606be1ac984de6d2ee71cd93f5c7e16af7ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package com.vaadin.tests.design.designroot;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;

import org.junit.Test;

import com.vaadin.tests.server.component.customcomponent.MyPrefilledCustomComponent;
import com.vaadin.ui.Component;
import com.vaadin.ui.VerticalLayout;

public class CustomComponentDesignRootTest {

    @Test
    public void customComponentReadVerticalLayoutDesign() {
        CustomComponentDesignRootForVerticalLayout r = new CustomComponentDesignRootForVerticalLayout();
        // Composition root, should be VerticalLayout
        Component compositionRoot = r.iterator().next();
        assertNotNull(compositionRoot);
        assertEquals(VerticalLayout.class, compositionRoot.getClass());
        assertNotNull(r.ok);
        assertNotNull(r.cancel);
        assertEquals("original", r.preInitializedField.getValue());
    }

    @Test
    public void customComponentReadCustomComponentDesign() {
        CustomComponentDesignRootForMyCustomComponent r = new CustomComponentDesignRootForMyCustomComponent();
        // Composition root, should be MyPrefilledCustomComponent
        Component compositionRoot = r.iterator().next();
        assertNotNull(compositionRoot);
        assertEquals(MyPrefilledCustomComponent.class,
                compositionRoot.getClass());

    }

}