Search in sources :

Example 6 with ViewDefinitionStateImpl

use of com.qcadoo.view.internal.internal.ViewDefinitionStateImpl in project qcadoo by qcadoo.

the class ViewDefinitionStateTest method shouldPerformEventOnState.

@Test
public void shouldPerformEventOnState() throws Exception {
    // given
    ViewDefinitionStateImpl viewDefinitionState = new ViewDefinitionStateImpl();
    ContainerState state1 = mock(ContainerState.class);
    given(state1.getName()).willReturn("name1");
    InternalComponentState state2 = mock(InternalComponentState.class);
    viewDefinitionState.addChild(state1);
    given(state1.getChild("name2")).willReturn(state2);
    // when
    viewDefinitionState.performEvent("name1.name2", "event", new String[] { "arg1", "arg2" });
    // then
    Mockito.verify(state2).performEvent(viewDefinitionState, "event", "arg1", "arg2");
}
Also used : ViewDefinitionStateImpl(com.qcadoo.view.internal.internal.ViewDefinitionStateImpl) ContainerState(com.qcadoo.view.internal.api.ContainerState) InternalComponentState(com.qcadoo.view.internal.api.InternalComponentState) Test(org.junit.Test) AbstractStateTest(com.qcadoo.view.internal.states.AbstractStateTest)

Aggregations

ViewDefinitionStateImpl (com.qcadoo.view.internal.internal.ViewDefinitionStateImpl)6 InternalComponentState (com.qcadoo.view.internal.api.InternalComponentState)4 InternalViewDefinitionState (com.qcadoo.view.internal.api.InternalViewDefinitionState)4 AbstractStateTest (com.qcadoo.view.internal.states.AbstractStateTest)4 Test (org.junit.Test)4 ContainerState (com.qcadoo.view.internal.api.ContainerState)3 ComponentState (com.qcadoo.view.api.ComponentState)2 FormComponentState (com.qcadoo.view.internal.components.form.FormComponentState)2 JSONObject (org.json.JSONObject)2 Entity (com.qcadoo.model.api.Entity)1 ViewDefinitionState (com.qcadoo.view.api.ViewDefinitionState)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1 JSONArray (org.json.JSONArray)1 JSONException (org.json.JSONException)1