@Override public IsFlowPanel newFlowPanel() { return new StubFlowPanel(); }
public ParentPresenter() { super(new StubFlowPanel()); }
@Test public void testFindByIdWithGrandchildren() { StubFlowPanel parent = new StubFlowPanel(); StubFlowPanel child = new StubFlowPanel(); StubFlowPanel grandchild = new StubFlowPanel(); grandchild.ensureDebugId("grandchild"); parent.add(child); child.add(grandchild); assertThat(parent.findById("grandchild"), is(sameInstance((IsWidget) grandchild))); }
@Test public void testFindByIdWithChildren() { StubFlowPanel parent = new StubFlowPanel(); StubFlowPanel child = new StubFlowPanel(); child.ensureDebugId("child"); parent.add(child); assertThat(parent.findById("child"), is(sameInstance((IsWidget) child))); }
@Test public void testFindByIdWithCompositeIsWidget() { StubFlowPanel parent = new StubFlowPanel(); StubFlowPanel uiXmlContent = new StubFlowPanel(); uiXmlContent.ensureDebugId("uiXmlContent"); CompositeIsWidget c = new CompositeIsWidget(); c.setWidget(uiXmlContent); parent.add(c); assertThat(parent.findById("uiXmlContent"), is(sameInstance((IsWidget) uiXmlContent))); }
@Test public void styleOf() { StubFlowPanel p = new StubFlowPanel(); TakesValue<String> style = TakesValues.styleOf(p); assertThat(style.getValue(), is(nullValue())); style.setValue("foo"); assertThat(p, hasStyle("foo")); assertThat(style.getValue(), is("foo")); style.setValue("bar"); assertThat(p, hasStyle("bar")); assertThat(p, not(hasStyle("foo"))); assertThat(style.getValue(), is("bar")); style.setValue(null); assertThat(p, not(hasStyle("bar"))); assertThat(style.getValue(), is(nullValue())); style.setValue(""); assertThat(style.getValue(), is(nullValue())); } }
@Test public void testClear() { StubFlowPanel p = new StubFlowPanel(); p.add(new StubTextBox()); p.clear(); }
private SomeUiXmlView() { panel = new StubFlowPanel(); box = new StubTextBox(); component = new SomeComponent(); panel.add(box); panel.add(component); setWidget(box); ensureDebugId("SomeUiXml"); } }
@Test public void whenIsAttach() { final BooleanProperty b = booleanProperty("b", false); final StubWidget w = new StubWidget(); final StubFlowPanel p = new StubFlowPanel(); binder.when(b).is(true).attach(w).to(p); assertThat(p.getWidgetCount(), is(0)); b.set(true); assertThat(p.getWidgetCount(), is(1)); b.set(false); assertThat(p.getWidgetCount(), is(0)); }