@Test public void testRegisterItem() { final HTMLElement expectedItem = mock(HTMLElement.class); final HTMLElement htmlElement = mock(HTMLElement.class); doReturn(expectedItem).when(view).createItem(htmlElement); doReturn(2).when(view).getMaxPositionY(); final HTMLElement actualItem = view.registerItem(htmlElement); verify(actualItem).setAttribute(DATA_Y_POSITION, 3); verify(actualItem).setAttribute(DATA_X_POSITION, 0); verify(dragArea).appendChild(actualItem); assertEquals(expectedItem, actualItem); }
@Override public HTMLElement registerItem(final HTMLElement htmlElement) { final HTMLElement item = createItem(htmlElement); Position.setY(item, getMaxPositionY() + 1d); Position.setX(item, 0); getDragArea().appendChild(item); return item; }
DNDListComponentView implements DNDListComponent.View { @Override public HTMLElement registerItem(final HTMLElement htmlElement) { final HTMLElement item = createItem(htmlElement); Position.setY(item, getMaxPositionY() + 1d); Position.setX(item, 0); getDragArea().appendChild(item); return item; } }
DNDListComponentView implements DNDListComponent.View { @Override public HTMLElement registerItem(final HTMLElement htmlElement) { final HTMLElement item = createItem(htmlElement); Position.setY(item, getMaxPositionY() + 1d); Position.setX(item, 0); getDragArea().appendChild(item); return item; } @Inject  DNDListComponentView(final HTMLDivElement dragArea); }
DNDListComponentView implements DNDListComponent.View { @Override public HTMLElement registerItem(final HTMLElement htmlElement) { final HTMLElement item = createItem(htmlElement); Position.setY(item, getMaxPositionY() + 1d); Position.setX(item, 0); getDragArea().appendChild(item); return item; } @Inject  DNDListComponentView(final HTMLDivElement dragArea); @Override void init(final DNDListComponent presenter); @Override HTMLElement registerItem(final HTMLElement htmlElement); @Override void refreshItemsPosition(); @Override void refreshItemsHTML(); @Override void consolidateHierarchicalLevel(final boolean isElementsDraggedByUser); @Override void consolidateYPosition(); @Override void clear(); @Override Optional<HTMLElement> getPreviousElement(final Element reference); @Override void refreshDragAreaSize(); @Override HTMLDivElement getDragArea(); }
DNDListComponentView implements DNDListComponent.View { @Override public HTMLElement registerItem(final HTMLElement htmlElement) { final HTMLElement item = createItem(htmlElement); Position.setY(item, getMaxPositionY() + 1d); Position.setX(item, 0); getDragArea().appendChild(item); return item; } @Inject  DNDListComponentView(final HTMLDivElement dragArea); @Override void init(final DNDListComponent presenter); @Override HTMLElement registerItem(final HTMLElement htmlElement); @Override void refreshItemsPosition(); @Override void refreshItemsHTML(); @Override void consolidateHierarchicalLevel(final boolean isElementsDraggedByUser); @Override void consolidateYPosition(); @Override void clear(); @Override Optional<HTMLElement> getPreviousElement(final Element reference); @Override void refreshDragAreaSize(); @Override HTMLDivElement getDragArea();  }