Search in sources :

Example 1 with JQuerySelectPickerTarget

use of org.uberfire.client.views.pfly.selectpicker.JQuerySelectPickerTarget in project kie-wb-common by kiegroup.

the class DataTypeSelectViewTest method testOnSelectChangeWhenTheSameValueIsSet.

@Test
public void testOnSelectChangeWhenTheSameValueIsSet() {
    final JQuerySelectPickerEvent event = mock(JQuerySelectPickerEvent.class);
    final JQuerySelectPickerTarget target = mock(JQuerySelectPickerTarget.class);
    final String newValue = "value";
    final String oldValue = "value";
    doNothing().when(view).setPickerValue(newValue);
    doReturn(oldValue).when(view).getValue();
    event.target = target;
    target.value = newValue;
    view.onSelectChange(event);
    verify(view, never()).setPickerValue(newValue);
    verify(presenter, never()).clearDataTypesList();
}
Also used : JQuerySelectPickerEvent(org.uberfire.client.views.pfly.selectpicker.JQuerySelectPickerEvent) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) JQuerySelectPickerTarget(org.uberfire.client.views.pfly.selectpicker.JQuerySelectPickerTarget) Test(org.junit.Test)

Example 2 with JQuerySelectPickerTarget

use of org.uberfire.client.views.pfly.selectpicker.JQuerySelectPickerTarget in project kie-wb-common by kiegroup.

the class DataTypeSelectViewTest method testOnSelectChangeWhenOtherValueIsSet.

@Test
public void testOnSelectChangeWhenOtherValueIsSet() {
    final JQuerySelectPickerEvent event = mock(JQuerySelectPickerEvent.class);
    final JQuerySelectPickerTarget target = mock(JQuerySelectPickerTarget.class);
    final String newValue = "newValue";
    final String oldValue = "oldValue";
    doNothing().when(view).setPickerValue(newValue);
    doReturn(oldValue).when(view).getValue();
    event.target = target;
    target.value = newValue;
    view.onSelectChange(event);
    verify(view).setPickerValue(newValue);
    verify(presenter).clearDataTypesList();
}
Also used : JQuerySelectPickerEvent(org.uberfire.client.views.pfly.selectpicker.JQuerySelectPickerEvent) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) JQuerySelectPickerTarget(org.uberfire.client.views.pfly.selectpicker.JQuerySelectPickerTarget) Test(org.junit.Test)

Example 3 with JQuerySelectPickerTarget

use of org.uberfire.client.views.pfly.selectpicker.JQuerySelectPickerTarget in project kie-wb-common by kiegroup.

the class DataTypeConstraintModalViewTest method testOnSelectChangeWhenValueIsNotBlank.

@Test
public void testOnSelectChangeWhenValueIsNotBlank() {
    final JQuerySelectPickerEvent jQueryEvent = mock(JQuerySelectPickerEvent.class);
    final JQuerySelectPickerTarget pickerTarget = mock(JQuerySelectPickerTarget.class);
    final ConstraintType constraintType = ENUMERATION;
    doNothing().when(view).loadComponent(ENUMERATION);
    jQueryEvent.target = pickerTarget;
    pickerTarget.value = constraintType.value();
    view.onSelectChange(jQueryEvent);
    verify(view).loadComponent(constraintType);
}
Also used : JQuerySelectPickerEvent(org.uberfire.client.views.pfly.selectpicker.JQuerySelectPickerEvent) ConstraintType(org.kie.workbench.common.dmn.api.definition.model.ConstraintType) JQuerySelectPickerTarget(org.uberfire.client.views.pfly.selectpicker.JQuerySelectPickerTarget) Test(org.junit.Test)

Example 4 with JQuerySelectPickerTarget

use of org.uberfire.client.views.pfly.selectpicker.JQuerySelectPickerTarget in project kie-wb-common by kiegroup.

the class KieAssetsDropdownViewTest method onDropdownChangeHandlerMethod.

@Test
public void onDropdownChangeHandlerMethod() {
    JQuerySelectPickerTarget targetMock = mock(JQuerySelectPickerTarget.class);
    targetMock.value = DEFAULT_VALUE;
    JQuerySelectPickerEvent eventMock = mock(JQuerySelectPickerEvent.class);
    eventMock.target = targetMock;
    kieAssetsDropdownView.onDropdownChangeHandlerMethod(eventMock);
    verify(presenterMock, times(1)).onValueChanged();
}
Also used : JQuerySelectPickerEvent(org.uberfire.client.views.pfly.selectpicker.JQuerySelectPickerEvent) JQuerySelectPickerTarget(org.uberfire.client.views.pfly.selectpicker.JQuerySelectPickerTarget) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)4 JQuerySelectPickerEvent (org.uberfire.client.views.pfly.selectpicker.JQuerySelectPickerEvent)4 JQuerySelectPickerTarget (org.uberfire.client.views.pfly.selectpicker.JQuerySelectPickerTarget)4 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)2 ConstraintType (org.kie.workbench.common.dmn.api.definition.model.ConstraintType)1