Search in sources :

Example 1 with UiSessionMock

use of org.eclipse.scout.rt.ui.html.json.fixtures.UiSessionMock in project scout.rt by eclipse.

the class JsonGroupBoxTest method setUp.

@Before
public void setUp() {
    m_groupBox.init();
    m_model.setBorderDecoration("x");
    m_model.setBorderVisible(true);
    m_uiSession = new UiSessionMock();
}
Also used : UiSessionMock(org.eclipse.scout.rt.ui.html.json.fixtures.UiSessionMock) Before(org.junit.Before)

Example 2 with UiSessionMock

use of org.eclipse.scout.rt.ui.html.json.fixtures.UiSessionMock in project scout.rt by eclipse.

the class JsonTabBoxTest method setUp.

@Before
public void setUp() {
    UiSessionMock uiSession = new UiSessionMock();
    m_tabBoxModel = Mockito.mock(ITabBox.class);
    m_groupBox1 = Mockito.mock(IGroupBox.class);
    Mockito.when(m_groupBox1.getContextMenu()).thenReturn(Mockito.mock(IFormFieldContextMenu.class));
    Mockito.when(m_groupBox1.isVisibleGranted()).thenReturn(true);
    m_groupBox2 = Mockito.mock(IGroupBox.class);
    Mockito.when(m_groupBox2.getContextMenu()).thenReturn(Mockito.mock(IFormFieldContextMenu.class));
    Mockito.when(m_groupBox2.isVisibleGranted()).thenReturn(true);
    m_uiFacade = Mockito.mock(ITabBoxUIFacade.class);
    Mockito.when(m_tabBoxModel.getGroupBoxes()).thenReturn(Arrays.asList(m_groupBox1, m_groupBox2));
    Mockito.when(m_tabBoxModel.getUIFacade()).thenReturn(m_uiFacade);
    m_tabBox = new JsonTabBox<ITabBox>(m_tabBoxModel, uiSession, "123", null);
    m_tabBox.attachAdapters(m_tabBoxModel.getGroupBoxes());
    m_uiSession = new UiSessionMock();
}
Also used : UiSessionMock(org.eclipse.scout.rt.ui.html.json.fixtures.UiSessionMock) IGroupBox(org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox) IFormFieldContextMenu(org.eclipse.scout.rt.client.ui.action.menu.root.IFormFieldContextMenu) ITabBox(org.eclipse.scout.rt.client.ui.form.fields.tabbox.ITabBox) ITabBoxUIFacade(org.eclipse.scout.rt.client.ui.form.fields.tabbox.ITabBoxUIFacade) Before(org.junit.Before)

Example 3 with UiSessionMock

use of org.eclipse.scout.rt.ui.html.json.fixtures.UiSessionMock in project scout.rt by eclipse.

the class JsonAdapterRegistryTest method testCreateDisposeInSameRequest.

@Test
public void testCreateDisposeInSameRequest() throws Exception {
    UiSession session = new UiSessionMock();
    IStringField model = new AbstractStringField() {
    };
    IJsonAdapter<?> adapter = session.getOrCreateJsonAdapter(model, null);
    // Note: Additionally, registry contains the "root adapter"
    assertEquals(2, UiSessionTestUtility.getJsonAdapterRegistry(session).size());
    assertEquals(1, session.currentJsonResponse().adapterMap().size());
    assertEquals(0, session.currentJsonResponse().eventList().size());
    model.setDisplayText("Test");
    assertEquals(2, UiSessionTestUtility.getJsonAdapterRegistry(session).size());
    assertEquals(1, session.currentJsonResponse().adapterMap().size());
    assertEquals(1, session.currentJsonResponse().eventList().size());
    adapter.dispose();
    assertEquals(1, UiSessionTestUtility.getJsonAdapterRegistry(session).size());
    assertEquals(0, session.currentJsonResponse().adapterMap().size());
    assertEquals(0, session.currentJsonResponse().eventList().size());
}
Also used : UiSessionMock(org.eclipse.scout.rt.ui.html.json.fixtures.UiSessionMock) IStringField(org.eclipse.scout.rt.client.ui.form.fields.stringfield.IStringField) AbstractStringField(org.eclipse.scout.rt.client.ui.form.fields.stringfield.AbstractStringField) UiSession(org.eclipse.scout.rt.ui.html.UiSession) Test(org.junit.Test)

Aggregations

UiSessionMock (org.eclipse.scout.rt.ui.html.json.fixtures.UiSessionMock)3 Before (org.junit.Before)2 IFormFieldContextMenu (org.eclipse.scout.rt.client.ui.action.menu.root.IFormFieldContextMenu)1 IGroupBox (org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox)1 AbstractStringField (org.eclipse.scout.rt.client.ui.form.fields.stringfield.AbstractStringField)1 IStringField (org.eclipse.scout.rt.client.ui.form.fields.stringfield.IStringField)1 ITabBox (org.eclipse.scout.rt.client.ui.form.fields.tabbox.ITabBox)1 ITabBoxUIFacade (org.eclipse.scout.rt.client.ui.form.fields.tabbox.ITabBoxUIFacade)1 UiSession (org.eclipse.scout.rt.ui.html.UiSession)1 Test (org.junit.Test)1