Skip to content
This repository has been archived by the owner on Dec 16, 2024. It is now read-only.

Commit

Permalink
dotCMS/core#14999 Dont remove the field until the response from the s…
Browse files Browse the repository at this point in the history
…erver is back (#776)
  • Loading branch information
fmontes committed Aug 17, 2018
1 parent cf17237 commit 61b8458
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,29 +113,6 @@ describe('ContentTypeFieldsRowComponent', () => {

expect(field).toEqual(editField);
});

it('should handle remove field event', () => {
let removeField;

const field = mockFieldRow.columns[0].fields[0];
fixture.detectChanges();

const column = de.query(By.css('.row-columns__item'));
const dragableItem = column.query(By.css('dot-content-type-field-dragabble-item'));

spyOn(dotDialogService, 'confirm').and.callFake((conf) => {
conf.accept();
});

comp.removeField.subscribe((eventField) => {
removeField = eventField;
});
dragableItem.componentInstance.remove.emit(field);

expect(field).toEqual(removeField);
const fieldRemoved = mockFieldRow.columns[0].fields.filter((columnField) => columnField === field);
expect(fieldRemoved).toEqual([]);
});
});

// Until 5.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ export class ContentTypeFieldsRowComponent extends BaseComponent {
onRemoveField(field: ContentTypeField): void {
this.dotDialogService.confirm({
accept: () => {
this.getField(field);
this.removeField.emit(field);
},
header: `${this.i18nMessages['contenttypes.action.delete']} ${this.i18nMessages['contenttypes.content.field']}`,
Expand Down Expand Up @@ -89,16 +88,6 @@ export class ContentTypeFieldsRowComponent extends BaseComponent {
}
}

private getField(field: ContentTypeField): any {
this.fieldRow.columns = this.fieldRow.columns.map((col) => {
const index: number = col.fields.indexOf(field);
if (index !== -1) {
col.fields.splice(index, 1);
}
return col;
});
}

private isRowFieldEmpty(): boolean {
return this.fieldRow.columns.map((column: FieldColumn) => column.fields.length).every(fieldsNumber => fieldsNumber === 0);
}
Expand Down

0 comments on commit 61b8458

Please sign in to comment.