@Test public void testEnableEditModeWhenDataTypeListItemIsAlreadyOnEditMode() { when(view.isOnFocusMode()).thenReturn(true); listItem.enableEditMode(); verify(view, never()).showSaveButton(); verify(view, never()).showDataTypeNameInput(); verify(view, never()).enableFocusMode(); verify(view, never()).hideListYesLabel(); verify(view, never()).showListContainer(); verify(dataTypeSelectComponent, never()).enableEditMode(); verify(dataTypeConstraintComponent, never()).enableEditMode(); verify(editModeToggleEvent, never()).fire(any()); verify(dataTypeList, never()).fireOnDataTypeListItemUpdateCallback(any(DataTypeListItem.class)); }
public void enableEditMode() { if (view.isOnFocusMode()) { return; } oldName = getDataType().getName(); oldType = getDataType().getType(); oldConstraint = getDataType().getConstraint(); oldIsList = getDataType().isList(); oldConstraintType = getDataType().getConstraintType(); view.showSaveButton(); view.showDataTypeNameInput(); view.showListContainer(); view.hideListYesLabel(); view.enableFocusMode(); dataTypeSelectComponent.enableEditMode(); dataTypeConstraintComponent.enableEditMode(); editModeToggleEvent.fire(new DataTypeEditModeToggleEvent(true, this)); dataTypeList.fireOnDataTypeListItemUpdateCallback(this); }
DataTypeListItem { public void enableEditMode() { if (view.isOnFocusMode()) { return; } oldName = getDataType().getName(); oldType = getDataType().getType(); oldConstraint = getDataType().getConstraint(); oldIsList = getDataType().isList(); oldConstraintType = getDataType().getConstraintType(); view.showSaveButton(); view.showDataTypeNameInput(); view.showListContainer(); view.hideListYesLabel(); view.enableFocusMode(); dataTypeSelectComponent.enableEditMode(); dataTypeConstraintComponent.enableEditMode(); editModeToggleEvent.fire(new DataTypeEditModeToggleEvent(true, this)); dataTypeList.fireOnDataTypeListItemUpdateCallback(this); } }
DataTypeListItem { public void enableEditMode() { if (view.isOnFocusMode()) { return; } oldName = getDataType().getName(); oldType = getDataType().getType(); oldConstraint = getDataType().getConstraint(); oldIsList = getDataType().isList(); oldConstraintType = getDataType().getConstraintType(); view.showSaveButton(); view.showDataTypeNameInput(); view.showListContainer(); view.hideListYesLabel(); view.enableFocusMode(); dataTypeSelectComponent.enableEditMode(); dataTypeConstraintComponent.enableEditMode(); editModeToggleEvent.fire(new DataTypeEditModeToggleEvent(true, this)); dataTypeList.fireOnDataTypeListItemUpdateCallback(this); } @Inject  DataTypeListItem(final View view,
                            final DataTypeSelect dataTypeSelectComponent,
                            final DataTypeConstraint dataTypeConstraintComponent,
                            final SmallSwitchComponent dataTypeListComponent,
                            final DataTypeManager dataTypeManager,
                            final DataTypeConfirmation confirmation,
                            final DataTypeNameFormatValidator nameFormatValidator,
                            final Event<DataTypeEditModeToggleEvent> editModeToggleEvent,
                            final Event<DataTypeChangedEvent> dataTypeChangedEvent); }
DataTypeListItem { public void enableEditMode() { if (view.isOnFocusMode()) { return; } oldName = getDataType().getName(); oldType = getDataType().getType(); oldConstraint = getDataType().getConstraint(); oldIsList = getDataType().isList(); oldConstraintType = getDataType().getConstraintType(); view.showSaveButton(); view.showDataTypeNameInput(); view.showListContainer(); view.hideListYesLabel(); view.enableFocusMode(); dataTypeSelectComponent.enableEditMode(); dataTypeConstraintComponent.enableEditMode(); editModeToggleEvent.fire(new DataTypeEditModeToggleEvent(true, this)); dataTypeList.fireOnDataTypeListItemUpdateCallback(this); } @Inject  DataTypeListItem(final View view,
                            final DataTypeSelect dataTypeSelectComponent,
                            final DataTypeConstraint dataTypeConstraintComponent,
                            final SmallSwitchComponent dataTypeListComponent,
                            final DataTypeManager dataTypeManager,
                            final DataTypeConfirmation confirmation,
                            final DataTypeNameFormatValidator nameFormatValidator,
                            final Event<DataTypeEditModeToggleEvent> editModeToggleEvent,
                            final Event<DataTypeChangedEvent> dataTypeChangedEvent); void init(final DataTypeList dataTypeList); DataType getDataType(); boolean isReadOnly(); int getLevel(); boolean isCollapsed(); void expand(); void collapse(); void enableEditMode(); void disableEditMode(); void saveAndCloseEditMode(); void remove(); Command removeItem(); Command destroy(); void destroyWithDependentTypes(); void destroyWithoutDependentTypes(); String getType(); void insertFieldAbove(); String insertFieldAbove(final DataType dataType); void insertFieldBelow(); String insertFieldBelow(final DataType dataType); void insertNestedField(); void insertNestedField(final DataType newDataType); HTMLElement getDragAndDropElement(); void highlightLevel(final DataType dataType); }
DataTypeListItem { public void enableEditMode() { if (view.isOnFocusMode()) { return; } oldName = getDataType().getName(); oldType = getDataType().getType(); oldConstraint = getDataType().getConstraint(); oldIsList = getDataType().isList(); oldConstraintType = getDataType().getConstraintType(); view.showSaveButton(); view.showDataTypeNameInput(); view.showListContainer(); view.hideListYesLabel(); view.enableFocusMode(); dataTypeSelectComponent.enableEditMode(); dataTypeConstraintComponent.enableEditMode(); editModeToggleEvent.fire(new DataTypeEditModeToggleEvent(true, this)); dataTypeList.fireOnDataTypeListItemUpdateCallback(this); } @Inject  DataTypeListItem(final View view,
                            final DataTypeSelect dataTypeSelectComponent,
                            final DataTypeConstraint dataTypeConstraintComponent,
                            final SmallSwitchComponent dataTypeListComponent,
                            final DataTypeManager dataTypeManager,
                            final DataTypeConfirmation confirmation,
                            final DataTypeNameFormatValidator nameFormatValidator,
                            final Event<DataTypeEditModeToggleEvent> editModeToggleEvent,
                            final Event<DataTypeChangedEvent> dataTypeChangedEvent); void init(final DataTypeList dataTypeList); DataType getDataType(); boolean isReadOnly(); int getLevel(); boolean isCollapsed(); void expand(); void collapse(); void enableEditMode(); void disableEditMode(); void saveAndCloseEditMode(); void remove(); Command removeItem(); Command destroy(); void destroyWithDependentTypes(); void destroyWithoutDependentTypes(); String getType(); void insertFieldAbove(); String insertFieldAbove(final DataType dataType); void insertFieldBelow(); String insertFieldBelow(final DataType dataType); void insertNestedField(); void insertNestedField(final DataType newDataType); HTMLElement getDragAndDropElement(); void highlightLevel(final DataType dataType);  }