Search in sources :

Example 1 with HTMLButtonElement

use of elemental2.dom.HTMLButtonElement in project kie-wb-common by kiegroup.

the class ReassignmentsEditorWidgetTest method testReadOnly.

@Test
public void testReadOnly() {
    setFieldValue(reassignmentWidgetViewImpl, "addButton", new HTMLButtonElement());
    setFieldValue(reassignmentWidgetViewImpl, "okButton", new HTMLButtonElement());
    setFieldValue(reassignmentWidget, "view", reassignmentWidgetViewImpl);
    setFieldValue(reassignmentsEditorWidget, "reassignmentWidget", reassignmentWidget);
    reassignmentsEditorWidget.setReadOnly(true);
    boolean readOnly = getFieldValue(ReassignmentWidgetViewImpl.class, reassignmentWidgetViewImpl, "readOnly");
    HTMLButtonElement addButton = getFieldValue(ReassignmentWidgetViewImpl.class, reassignmentWidgetViewImpl, "addButton");
    HTMLButtonElement okButton = getFieldValue(ReassignmentWidgetViewImpl.class, reassignmentWidgetViewImpl, "okButton");
    Assert.assertTrue(readOnly);
    Assert.assertTrue(addButton.disabled);
    Assert.assertTrue(okButton.disabled);
}
Also used : HTMLButtonElement(elemental2.dom.HTMLButtonElement) Test(org.junit.Test) ReflectionUtilsTest(org.kie.workbench.common.stunner.bpmn.client.forms.util.ReflectionUtilsTest)

Example 2 with HTMLButtonElement

use of elemental2.dom.HTMLButtonElement in project kie-wb-common by kiegroup.

the class ReassignmentEditorWidgetTest method setUp.

@Before
public void setUp() throws Exception {
    super.setUp();
    GwtMockito.initMocks(this);
    modal = mock(BaseModal.class);
    notStarted = mock(Option.class);
    notCompleted = mock(Option.class);
    customerBinder = mock(DataBinder.class);
    multipleLiveSearchSelectionHandlerUsers = mock(MultipleLiveSearchSelectionHandler.class);
    multipleLiveSearchSelectionHandlerGroups = mock(MultipleLiveSearchSelectionHandler.class);
    doNothing().when(modal).hide();
    doNothing().when(modal).show();
    doNothing().when(reassignmentEvent).fire(any(ReassignmentEvent.class));
    doCallRealMethod().when(reassignmentEditorWidget).setReadOnly(any(boolean.class));
    doCallRealMethod().when(reassignmentEditorWidget).getNameHeader();
    setFieldValue(reassignmentEditorWidget, "view", view);
    setFieldValue(reassignmentEditorWidget, "translationService", translationService);
    doCallRealMethod().when(typeSelect).setValue(any(String.class));
    doCallRealMethod().when(typeSelect).getValue();
    doCallRealMethod().when(view).setReadOnly(any(boolean.class));
    doCallRealMethod().when(view).initTypeSelector();
    doCallRealMethod().when(view).createOrEdit(any(ReassignmentWidgetView.class), any(ReassignmentRow.class));
    doCallRealMethod().when(view).ok();
    setFieldValue(view, "modal", modal);
    setFieldValue(view, "customerBinder", customerBinder);
    setFieldValue(view, "multipleLiveSearchSelectionHandlerUsers", multipleLiveSearchSelectionHandlerUsers);
    setFieldValue(view, "multipleLiveSearchSelectionHandlerGroups", multipleLiveSearchSelectionHandlerGroups);
    setFieldValue(view, "reassignmentEvent", reassignmentEvent);
    setFieldValue(view, "validator", validator);
    setFieldValue(view, "closeButton", new HTMLButtonElement());
    setFieldValue(view, "okButton", new HTMLButtonElement());
    setFieldValue(view, "customerBinder", customerBinder);
    setFieldValue(view, "typeSelect", typeSelect);
    setFieldValue(view, "notStarted", notStarted);
    setFieldValue(view, "notCompleted", notCompleted);
    doCallRealMethod().when(typeSelect).setValue(any(String.class));
    doCallRealMethod().when(typeSelect).getValue();
    when(validator.validate(any(ReassignmentRow.class))).thenReturn(Collections.EMPTY_SET);
    doCallRealMethod().when(view).init(any(ReassignmentEditorWidgetView.Presenter.class));
    when(translationService.getValue(any(String.class))).thenReturn("Reassignment");
    view.initTypeSelector();
}
Also used : BaseModal(org.uberfire.ext.widgets.common.client.common.popups.BaseModal) MultipleLiveSearchSelectionHandler(org.uberfire.ext.widgets.common.client.dropdown.MultipleLiveSearchSelectionHandler) ReassignmentEvent(org.kie.workbench.common.stunner.bpmn.client.forms.fields.reassignmentsEditor.event.ReassignmentEvent) Option(org.gwtbootstrap3.extras.select.client.ui.Option) DataBinder(org.jboss.errai.databinding.client.api.DataBinder) HTMLButtonElement(elemental2.dom.HTMLButtonElement) ReassignmentRow(org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.ReassignmentRow) Before(org.junit.Before)

Example 3 with HTMLButtonElement

use of elemental2.dom.HTMLButtonElement in project kie-wb-common by kiegroup.

the class ReassignmentEditorWidgetTest method testReadOnly.

@Test
public void testReadOnly() {
    reassignmentEditorWidget.setReadOnly(true);
    HTMLButtonElement closeButton = getFieldValue(ReassignmentEditorWidgetViewImpl.class, view, "closeButton");
    HTMLButtonElement okButton = getFieldValue(ReassignmentEditorWidgetViewImpl.class, view, "okButton");
    Assert.assertFalse(closeButton.disabled);
    Assert.assertTrue(okButton.disabled);
}
Also used : HTMLButtonElement(elemental2.dom.HTMLButtonElement) ReflectionUtilsTest(org.kie.workbench.common.stunner.bpmn.client.forms.util.ReflectionUtilsTest) Test(org.junit.Test)

Example 4 with HTMLButtonElement

use of elemental2.dom.HTMLButtonElement in project kie-wb-common by kiegroup.

the class NotificationsEditorWidgetTest method testReadOnly.

@Test
public void testReadOnly() {
    setFieldValue(notificationWidgetViewImpl, "addButton", new HTMLButtonElement());
    setFieldValue(notificationWidgetViewImpl, "okButton", new HTMLButtonElement());
    setFieldValue(notificationWidget, "view", notificationWidgetViewImpl);
    setFieldValue(notificationsEditorWidget, "notificationWidget", notificationWidget);
    notificationsEditorWidget.setReadOnly(true);
    boolean readOnly = getFieldValue(NotificationWidgetViewImpl.class, notificationWidgetViewImpl, "readOnly");
    HTMLButtonElement addButton = getFieldValue(NotificationWidgetViewImpl.class, notificationWidgetViewImpl, "addButton");
    HTMLButtonElement okButton = getFieldValue(NotificationWidgetViewImpl.class, notificationWidgetViewImpl, "okButton");
    Assert.assertTrue(readOnly);
    Assert.assertTrue(addButton.disabled);
    Assert.assertTrue(okButton.disabled);
}
Also used : HTMLButtonElement(elemental2.dom.HTMLButtonElement) Test(org.junit.Test) ReflectionUtilsTest(org.kie.workbench.common.stunner.bpmn.client.forms.util.ReflectionUtilsTest)

Example 5 with HTMLButtonElement

use of elemental2.dom.HTMLButtonElement in project kie-wb-common by kiegroup.

the class NotificationEditorWidgetTest method testReadOnly.

@Test
public void testReadOnly() {
    presenter.setReadOnly(true);
    HTMLButtonElement closeButton = getFieldValue(NotificationEditorWidgetViewImpl.class, view, "closeButton");
    HTMLButtonElement okButton = getFieldValue(NotificationEditorWidgetViewImpl.class, view, "okButton");
    assertFalse(closeButton.disabled);
    assertTrue(okButton.disabled);
}
Also used : HTMLButtonElement(elemental2.dom.HTMLButtonElement) ReflectionUtilsTest(org.kie.workbench.common.stunner.bpmn.client.forms.util.ReflectionUtilsTest) Test(org.junit.Test)

Aggregations

HTMLButtonElement (elemental2.dom.HTMLButtonElement)6 Test (org.junit.Test)4 ReflectionUtilsTest (org.kie.workbench.common.stunner.bpmn.client.forms.util.ReflectionUtilsTest)4 Option (org.gwtbootstrap3.extras.select.client.ui.Option)2 DataBinder (org.jboss.errai.databinding.client.api.DataBinder)2 Before (org.junit.Before)2 BaseModal (org.uberfire.ext.widgets.common.client.common.popups.BaseModal)2 MultipleLiveSearchSelectionHandler (org.uberfire.ext.widgets.common.client.dropdown.MultipleLiveSearchSelectionHandler)2 ParagraphElement (com.google.gwt.dom.client.ParagraphElement)1 HTMLInputElement (elemental2.dom.HTMLInputElement)1 Select (org.gwtbootstrap3.extras.select.client.ui.Select)1 NotificationRow (org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.NotificationRow)1 ReassignmentRow (org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.ReassignmentRow)1 NotificationEvent (org.kie.workbench.common.stunner.bpmn.client.forms.fields.notificationsEditor.event.NotificationEvent)1 ReassignmentEvent (org.kie.workbench.common.stunner.bpmn.client.forms.fields.reassignmentsEditor.event.ReassignmentEvent)1 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)1 SingleLiveSearchSelectionHandler (org.uberfire.ext.widgets.common.client.dropdown.SingleLiveSearchSelectionHandler)1