OnlineGlom: Make clientFactory a (protected) member, and test it a bit.
[online-glom:gwt-glom.git] / src / test / java / org / glom / web / client / GwtTestOnlineGlom.java
1 package org.glom.web.client;
2
3 import com.google.gwt.event.dom.client.KeyCodes;
4 import com.google.gwt.user.client.Event;
5
6 import com.octo.gwt.test.Mock;
7 import com.octo.gwt.test.GwtTestWithEasyMock;
8 import com.octo.gwt.test.utils.events.Browser;
9 import com.octo.gwt.test.utils.events.EventBuilder;
10
11 import static org.junit.Assert.*;
12 import org.junit.Before;
13 import org.junit.Test;
14 import org.junit.Assert;
15
16 import org.glom.web.client.mvp.AppPlaceHistoryMapper;
17 import org.glom.web.client.ui.DocumentSelectionView;
18 import org.easymock.EasyMock;
19
20 public class GwtTestOnlineGlom extends GwtTestWithEasyMock {
21
22         /** Tell gwt-test-utils to use this mock when trying to create this class via GWT.create() in OnlineGlom.
23          */
24         @Mock
25         private AppPlaceHistoryMapper mockAppPlaceHistoryMapper;
26
27         private OnlineGlom app;
28
29
30         @Test
31         public void testSomething() {
32                 assertTrue(true);
33                 /* TODO: For instance:
34                 // Arrange
35                 Browser.fillText(app.nameField, "123");
36
37                 // Act
38                 Browser.click(app.sendButton);
39
40                 // Assert
41                 assertFalse(app.dialogBox.isShowing());
42                 assertEquals("Please enter at least four characters",
43                         app.errorLabel.getText());
44                 */
45         }
46
47         @Override
48         public String getModuleName() {
49                 return "org.glom.web.OnlineGlom";
50         }
51
52         @Before
53         public void beforeOnlineGlom() {
54                 app = new OnlineGlom();
55                 app.onModuleLoad();
56                 
57                 assertNotNull(app.clientFactory);
58                 DocumentSelectionView view = app.clientFactory.getDocumentSelectionView();
59                 assertNotNull(view);
60                 assertNotNull(view.asWidget());
61                 assertTrue(view.asWidget().isVisible());
62                 
63                 // Some pre-assertions
64                 assertTrue(app.docSelectionPanel.isVisible());
65                 assertFalse(app.dataPanel.isVisible());
66                 assertFalse(app.tableSelectionPanel.isVisible());
67                 //TODO: For instance: assertEquals("", app.docSelectionPanel.getText());
68         }
69
70 }