Search in sources :

Example 1 with LIElement

use of com.google.gwt.dom.client.LIElement in project gwt-test-utils by gwt-test-utils.

the class UiBinderWithDockLayoutPanelTest method uiBinderWithDockLayoutPanel.

@Test
public void uiBinderWithDockLayoutPanel() {
    // Given
    UiBinderWithDockLayoutPanel panel = new UiBinderWithDockLayoutPanel();
    // When
    RootLayoutPanel.get().add(panel);
    // Then
    assertThat(panel.northLabel.getText()).isEqualTo("North");
    assertThat(panel.centerLabel.getText()).isEqualTo("Center");
    assertThat(panel.eastLabel.getText()).isEqualTo("East");
    assertThat(panel.southLabel.getText()).isEqualTo("South");
    assertThat(panel.centerLabel.getText()).isEqualTo("Center");
    assertThat(panel.getLayout().getWidgetDirection(panel.northLabel)).isEqualTo(Direction.NORTH);
    assertThat(panel.westHTML.getHTML()).isEqualTo("<ul><li id=\"li-west0\">west0</li><li id=\"li-west1\">west1</li></ul>");
    LIElement li0 = panel.westHTML.getElement().getFirstChildElement().getChild(0).cast();
    LIElement li1 = panel.westHTML.getElement().getFirstChildElement().getChild(1).cast();
    assertThat(li0.getInnerText()).isEqualTo("west0");
    assertThat(li1.getInnerText()).isEqualTo("west1");
    assertThat(Document.get().getElementById("li-west0")).isEqualTo(li0);
    assertThat(Document.get().getElementById("li-west1")).isEqualTo(li1);
}
Also used : LIElement(com.google.gwt.dom.client.LIElement) GwtTestTest(com.googlecode.gwt.test.GwtTestTest) Test(org.junit.Test)

Example 2 with LIElement

use of com.google.gwt.dom.client.LIElement in project gwt-test-utils by gwt-test-utils.

the class UiBinderWithSplitLayoutPanelTest method uiBinderWithSplitLayoutPanel.

@Test
public void uiBinderWithSplitLayoutPanel() {
    // Given
    UiBinderWithSplitLayoutPanel panel = new UiBinderWithSplitLayoutPanel();
    // When
    RootLayoutPanel.get().add(panel);
    // Then
    assertThat(panel.northLabel.getText()).isEqualTo("North");
    assertThat(panel.centerLabel.getText()).isEqualTo("Center");
    assertThat(panel.eastLabel.getText()).isEqualTo("East");
    assertThat(panel.southLabel.getText()).isEqualTo("South");
    assertThat(panel.centerLabel.getText()).isEqualTo("Center");
    assertThat(panel.getLayout().getWidgetDirection(panel.northLabel)).isEqualTo(Direction.NORTH);
    assertThat(panel.westHTML.getHTML()).isEqualTo("<ul><li id=\"li-west0\">west0</li><li id=\"li-west1\">west1</li></ul>");
    LIElement li0 = panel.westHTML.getElement().getFirstChildElement().getChild(0).cast();
    LIElement li1 = panel.westHTML.getElement().getFirstChildElement().getChild(1).cast();
    assertThat(li0.getInnerText()).isEqualTo("west0");
    assertThat(li1.getInnerText()).isEqualTo("west1");
    assertThat(Document.get().getElementById("li-west0")).isEqualTo(li0);
    assertThat(Document.get().getElementById("li-west1")).isEqualTo(li1);
    assertThat(panel.getLayout().getSplitterSize()).isEqualTo(15);
}
Also used : LIElement(com.google.gwt.dom.client.LIElement) GwtTestTest(com.googlecode.gwt.test.GwtTestTest) Test(org.junit.Test)

Example 3 with LIElement

use of com.google.gwt.dom.client.LIElement in project drools-wb by kiegroup.

the class HitPolicySelectorViewImpl method addHitPolicyOption.

@Override
public void addHitPolicyOption(final GuidedDecisionTable52.HitPolicy hitPolicy) {
    final AnchorElement anchor = Document.get().createAnchorElement();
    anchor.setInnerText(HitPolicyInternationalizer.internationalize(hitPolicy));
    Event.sinkEvents(anchor, Event.ONCLICK);
    Event.setEventListener(anchor, event -> {
        if (Event.ONCLICK == event.getTypeInt()) {
            presenter.onHitPolicySelected(hitPolicy);
        }
    });
    final LIElement li = Document.get().createLIElement();
    li.appendChild(anchor);
    listOfAvailableHitModes.appendChild((Node) li);
}
Also used : AnchorElement(com.google.gwt.dom.client.AnchorElement) LIElement(com.google.gwt.dom.client.LIElement)

Aggregations

LIElement (com.google.gwt.dom.client.LIElement)3 GwtTestTest (com.googlecode.gwt.test.GwtTestTest)2 Test (org.junit.Test)2 AnchorElement (com.google.gwt.dom.client.AnchorElement)1