Search in sources :

Example 11 with LayoutDescriptor

use of com.enonic.xp.region.LayoutDescriptor in project xp by enonic.

the class DescriptorsTest method layoutDescriptor.

@Test
public void layoutDescriptor() {
    final Form layoutForm = Form.create().addFormItem(Input.create().name("columns").label("columns").inputType(InputTypeName.DOUBLE).build()).build();
    final LayoutDescriptor layoutDescriptor = LayoutDescriptor.create().displayName("Fancy layout").config(layoutForm).regions(RegionDescriptors.create().build()).key(DescriptorKey.from("module:fancy-layout")).build();
    final LayoutDescriptor copy = LayoutDescriptor.copyOf(layoutDescriptor).build();
    assertEquals("Fancy layout", layoutDescriptor.getDisplayName());
    assertEquals(layoutForm, layoutDescriptor.getConfig());
    assertEquals(layoutDescriptor.getComponentPath(), copy.getComponentPath());
    assertEquals(layoutDescriptor.getRegions(), copy.getRegions());
}
Also used : LayoutDescriptor(com.enonic.xp.region.LayoutDescriptor) Form(com.enonic.xp.form.Form) Test(org.junit.jupiter.api.Test)

Example 12 with LayoutDescriptor

use of com.enonic.xp.region.LayoutDescriptor in project xp by enonic.

the class LayoutDescriptorServiceTest method testGetByKey.

@Test
public void testGetByKey() throws Exception {
    final DescriptorKey key = DescriptorKey.from("myapp1:mylayout");
    final LayoutDescriptor descriptor = this.service.getByKey(key);
    assertNotNull(descriptor);
    assertTrue(Instant.now().isAfter(descriptor.getModifiedTime()));
}
Also used : LayoutDescriptor(com.enonic.xp.region.LayoutDescriptor) DescriptorKey(com.enonic.xp.page.DescriptorKey) Test(org.junit.jupiter.api.Test) AbstractDescriptorServiceTest(com.enonic.xp.core.impl.content.page.AbstractDescriptorServiceTest)

Aggregations

LayoutDescriptor (com.enonic.xp.region.LayoutDescriptor)12 PartDescriptor (com.enonic.xp.region.PartDescriptor)5 Test (org.junit.jupiter.api.Test)5 Form (com.enonic.xp.form.Form)4 LayoutComponent (com.enonic.xp.region.LayoutComponent)3 PartComponent (com.enonic.xp.region.PartComponent)3 PropertyTree (com.enonic.xp.data.PropertyTree)2 DescriptorKey (com.enonic.xp.page.DescriptorKey)2 PortalRequest (com.enonic.xp.portal.PortalRequest)2 ControllerScript (com.enonic.xp.portal.controller.ControllerScript)2 ControllerScriptFactory (com.enonic.xp.portal.controller.ControllerScriptFactory)2 LayoutDescriptorService (com.enonic.xp.region.LayoutDescriptorService)2 WebSocketEvent (com.enonic.xp.web.websocket.WebSocketEvent)2 EditableContent (com.enonic.xp.content.EditableContent)1 AbstractDescriptorServiceTest (com.enonic.xp.core.impl.content.page.AbstractDescriptorServiceTest)1 PropertySet (com.enonic.xp.data.PropertySet)1 Page (com.enonic.xp.page.Page)1 PageDescriptor (com.enonic.xp.page.PageDescriptor)1 PortalResponseSerializer (com.enonic.xp.portal.impl.controller.PortalResponseSerializer)1 LayoutRegions (com.enonic.xp.region.LayoutRegions)1