@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<KieSelectOption> options = singletonList(new KieSelectOption("Label", "Value")); kieSelectElement.setup( container, options, Arrays.asList("value1", "value2"), value -> { }); verify(view).setValue(eq(Arrays.asList("value1", "value2"))); verify(view).initSelect(); verify(optionsListPresenter).setup(eq(selectElement), eq(options), any()); assertEquals("bar", container.innerHTML); }
public void setup(final Element element, final List<KieSelectOption> options, final List<String> initialValue, final Consumer<List<String>> onChange) { elemental2DomUtil.removeAllElementChildren(element); element.appendChild(view.getElement()); optionsListPresenter.setup( view.getSelect(), options, (item, presenter) -> presenter.setup(item, this)); view.initSelect(); view.setValue(initialValue); this.onChange = onChange; }
KieMultipleSelectElement implements KieSelectElementBase { public void setup(final Element element, final List<KieSelectOption> options, final List<String> initialValue, final Consumer<List<String>> onChange) { elemental2DomUtil.removeAllElementChildren(element); element.appendChild(view.getElement()); optionsListPresenter.setup( view.getSelect(), options, (item, presenter) -> presenter.setup(item, this)); view.initSelect(); view.setValue(initialValue); this.onChange = onChange; } }
KieMultipleSelectElement implements KieSelectElementBase { public void setup(final Element element, final List<KieSelectOption> options, final List<String> initialValue, final Consumer<List<String>> onChange) { elemental2DomUtil.removeAllElementChildren(element); element.appendChild(view.getElement()); optionsListPresenter.setup( view.getSelect(), options, (item, presenter) -> presenter.setup(item, this)); view.initSelect(); view.setValue(initialValue); this.onChange = onChange; } @Inject  KieMultipleSelectElement(final View view,
                                    final KieSelectOptionsListPresenter optionsListPresenter,
                                    final Elemental2DomUtil elemental2DomUtil); }
KieMultipleSelectElement implements KieSelectElementBase { public void setup(final Element element, final List<KieSelectOption> options, final List<String> initialValue, final Consumer<List<String>> onChange) { elemental2DomUtil.removeAllElementChildren(element); element.appendChild(view.getElement()); optionsListPresenter.setup( view.getSelect(), options, (item, presenter) -> presenter.setup(item, this)); view.initSelect(); view.setValue(initialValue); this.onChange = onChange; } @Inject  KieMultipleSelectElement(final View view,
                                    final KieSelectOptionsListPresenter optionsListPresenter,
                                    final Elemental2DomUtil elemental2DomUtil); @PostConstruct void init(); void setup(final Element element,
                      final List<KieSelectOption> options,
                      final List<String> initialValue,
                      final Consumer<List<String>> onChange); void onChange(); void setValue(final List<String> value); List<String> getValue(); }
KieMultipleSelectElement implements KieSelectElementBase { public void setup(final Element element, final List<KieSelectOption> options, final List<String> initialValue, final Consumer<List<String>> onChange) { elemental2DomUtil.removeAllElementChildren(element); element.appendChild(view.getElement()); optionsListPresenter.setup( view.getSelect(), options, (item, presenter) -> presenter.setup(item, this)); view.initSelect(); view.setValue(initialValue); this.onChange = onChange; } @Inject  KieMultipleSelectElement(final View view,
                                    final KieSelectOptionsListPresenter optionsListPresenter,
                                    final Elemental2DomUtil elemental2DomUtil); @PostConstruct void init(); void setup(final Element element,
                      final List<KieSelectOption> options,
                      final List<String> initialValue,
                      final Consumer<List<String>> onChange); void onChange(); void setValue(final List<String> value); List<String> getValue();  }