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();
}
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();
}
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());
}
Aggregations