Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
feat: TT-35 solve PR comments
  • Loading branch information
eduardisrael committed Mar 15, 2021
commit 258be2bbeddbda1ad73da65c7f0aede435537b32
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
</div>
<div class="modal fade" id="editRecordsByDate" tabindex="-1" role="dialog">
<div class="modal-dialog modal-dialog-centered modal-lg" role="document">
<div class="modal-content" cdkDrag (cdkDragEnded)="dragEnded($event)">
<div class="modal-content" cdkDrag (cdkDragEnded)="resetDraggablePosition($event)">
<div class="modal-header">
<h5 class="modal-title">{{ entryId ? 'Edit Entry' : 'New Entry' }}</h5>
</div>
Expand Down
16 changes: 11 additions & 5 deletions src/app/modules/time-entries/pages/time-entries.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -443,10 +443,16 @@ describe('TimeEntriesComponent', () => {
expect(component.entry).toEqual(newEntry);
});

it('When I stop dragging the modal, it should call dragEnded', () => {
const dragEndEvent = new DragEvent('CdkDragEnd');
spyOn(component, 'dragEnded');
component.dragEnded(dragEndEvent);
expect(component.dragEnded).toHaveBeenCalledWith(dragEndEvent);
it('When I stop dragging the modal, it should reset Draggable Position', () => {
const dragEndEventStub = {
source: {
_dragRef: {
reset: () => { }
}
}
};
spyOn(dragEndEventStub.source._dragRef, 'reset');
component.resetDraggablePosition(dragEndEventStub);
expect(dragEndEventStub.source._dragRef.reset).toHaveBeenCalled();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ export class TimeEntriesComponent implements OnInit, OnDestroy {
this.message = `Are you sure you want to delete ${item.activity_name}?`;
this.showModal = true;
}
dragEnded(event: any): void {
resetDraggablePosition(event: any): void {
event.source._dragRef.reset();
}
}