Search in sources :

Example 1 with ModalConfigurationContext

use of org.uberfire.ext.layout.editor.client.api.ModalConfigurationContext in project kie-wb-common by kiegroup.

the class EditorFieldLayoutComponentTest method testOnPressOk.

protected void testOnPressOk(boolean bound, boolean withConfigContext) {
    FieldDefinition fieldCopy = setupFormEditorHelper();
    ModalConfigurationContext ctx = mock(ModalConfigurationContext.class);
    if (bound) {
        when(fieldCopy.getBinding()).thenReturn(BINDING_FIRSTNAME);
    }
    if (withConfigContext) {
        when(ctx.getComponentProperties()).thenReturn(mock(Map.class));
        editorFieldLayoutComponent.getConfigurationModal(ctx);
    }
    editorFieldLayoutComponent.onPressOk(fieldCopy);
    assertSame(fieldCopy, editorFieldLayoutComponent.getField());
    verify(syncPaletteEvent).fire(any());
    verify(formEditorHelper, bound ? times(1) : times(0)).removeAvailableField(any());
    verify(ctx, withConfigContext ? times(1) : times(0)).configurationFinished();
}
Also used : FieldDefinition(org.kie.workbench.common.forms.model.FieldDefinition) TextBoxFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.textBox.definition.TextBoxFieldDefinition) ModalConfigurationContext(org.uberfire.ext.layout.editor.client.api.ModalConfigurationContext) Map(java.util.Map)

Example 2 with ModalConfigurationContext

use of org.uberfire.ext.layout.editor.client.api.ModalConfigurationContext in project kie-wb-common by kiegroup.

the class EditorFieldLayoutComponentTest method testHelperOnCloseWithContext.

@Test
public void testHelperOnCloseWithContext() {
    ModalConfigurationContext ctx = mock(ModalConfigurationContext.class);
    when(ctx.getComponentProperties()).thenReturn(mock(Map.class));
    testDroppingNewField();
    editorFieldLayoutComponent.getConfigurationModal(ctx);
    propertiesRendererHelper.onClose();
    assertFalse(editorFieldLayoutComponent.showProperties);
    verify(ctx).configurationCancelled();
}
Also used : ModalConfigurationContext(org.uberfire.ext.layout.editor.client.api.ModalConfigurationContext) Map(java.util.Map) Test(org.junit.Test)

Example 3 with ModalConfigurationContext

use of org.uberfire.ext.layout.editor.client.api.ModalConfigurationContext in project kie-wb-common by kiegroup.

the class EditorFieldLayoutComponentTest method testOpenFieldProperties.

@Test
public void testOpenFieldProperties() {
    testDroppingNewField();
    ModalConfigurationContext modalConfigurationContext = mock(ModalConfigurationContext.class);
    when(modalConfigurationContext.getComponentProperties()).thenReturn(layoutComponent.getProperties());
    editorFieldLayoutComponent.getConfigurationModal(modalConfigurationContext);
    verify(propertiesRenderer).render(any());
    verify(propertiesRenderer).getView();
    verify(fieldPropertiesRendererView).getPropertiesModal();
}
Also used : ModalConfigurationContext(org.uberfire.ext.layout.editor.client.api.ModalConfigurationContext) Test(org.junit.Test)

Example 4 with ModalConfigurationContext

use of org.uberfire.ext.layout.editor.client.api.ModalConfigurationContext in project kie-wb-common by kiegroup.

the class EditorFieldLayoutComponentTest method testOpenFieldPropertiesBeforeDrop.

@Test
public void testOpenFieldPropertiesBeforeDrop() {
    ModalConfigurationContext modalConfigurationContext = mock(ModalConfigurationContext.class);
    when(modalConfigurationContext.getComponentProperties()).thenReturn(layoutComponent.getProperties());
    editorFieldLayoutComponent.getConfigurationModal(modalConfigurationContext);
    verify(editorFieldLayoutComponent).init(context, fieldDefinition);
    verify(fieldRenderer).init(context, fieldDefinition);
    verify(propertiesRenderer).render(any());
}
Also used : ModalConfigurationContext(org.uberfire.ext.layout.editor.client.api.ModalConfigurationContext) Test(org.junit.Test)

Aggregations

ModalConfigurationContext (org.uberfire.ext.layout.editor.client.api.ModalConfigurationContext)4 Test (org.junit.Test)3 Map (java.util.Map)2 TextBoxFieldDefinition (org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.textBox.definition.TextBoxFieldDefinition)1 FieldDefinition (org.kie.workbench.common.forms.model.FieldDefinition)1