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