Search in sources :

Example 1 with HTMLSelectElement

use of elemental2.dom.HTMLSelectElement in project kie-wb-common by kiegroup.

the class KieSelectElementTest method testSetup.

@Test
public void testSetup() {
    final HTMLElement viewRoot = spy(new HTMLElement());
    viewRoot.innerHTML = "bar";
    doReturn(viewRoot).when(view).getElement();
    final HTMLSelectElement selectElement = spy(new HTMLSelectElement());
    doReturn(selectElement).when(view).getSelect();
    final Element container = spy(new Element() {

        @Override
        public Node appendChild(final Node node) {
            if (node instanceof HTMLElement) {
                this.innerHTML += ((HTMLElement) node).innerHTML;
            }
            return node;
        }
    });
    container.innerHTML = "";
    final List<Option> options = singletonList(new Option("Label", "Value"));
    kieSelectElement.setup(container, options, "Value", value -> {
    });
    verify(view).setValue(eq("Value"));
    verify(view).initSelect();
    verify(optionsListPresenter).setup(eq(selectElement), eq(options), any());
    assertEquals("bar", container.innerHTML);
}
Also used : HTMLElement(elemental2.dom.HTMLElement) Element(elemental2.dom.Element) HTMLElement(elemental2.dom.HTMLElement) HTMLSelectElement(elemental2.dom.HTMLSelectElement) Node(elemental2.dom.Node) Option(org.kie.workbench.common.screens.library.client.settings.util.KieSelectElement.Option) HTMLSelectElement(elemental2.dom.HTMLSelectElement) Test(org.junit.Test)

Aggregations

Element (elemental2.dom.Element)1 HTMLElement (elemental2.dom.HTMLElement)1 HTMLSelectElement (elemental2.dom.HTMLSelectElement)1 Node (elemental2.dom.Node)1 Test (org.junit.Test)1 Option (org.kie.workbench.common.screens.library.client.settings.util.KieSelectElement.Option)1