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
41 changes: 41 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"private": true,
"dependencies": {
"@angular/animations": "^10.2.2",
"@angular/cdk": "^11.2.3",
"@angular/common": "~10.2.2",
"@angular/compiler": "~10.2.2",
"@angular/core": "~10.2.2",
Expand Down
2 changes: 2 additions & 0 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { DataTablesModule } from 'angular-datatables';
import { StoreModule } from '@ngrx/store';
import { EffectsModule } from '@ngrx/effects';
import { StoreDevtoolsModule } from '@ngrx/store-devtools';
import { DragDropModule } from '@angular/cdk/drag-drop';

import { NgxPaginationModule } from 'ngx-pagination';
import { AutocompleteLibModule } from 'angular-ng-autocomplete';
Expand Down Expand Up @@ -144,6 +145,7 @@ const maskConfig: Partial<IConfig> = {
AutocompleteLibModule,
NgxMaterialTimepickerModule,
UiSwitchModule,
DragDropModule,
StoreModule.forRoot(reducers, {
metaReducers,
}),
Expand Down
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">
<div class="modal-content" cdkDrag (cdkDragEnded)="dragEnded($event)">
<div class="modal-header">
<h5 class="modal-title">{{ entryId ? 'Edit Entry' : 'New Entry' }}</h5>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -442,4 +442,11 @@ describe('TimeEntriesComponent', () => {
component.newEntry();
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);
});
});
5 changes: 4 additions & 1 deletion src/app/modules/time-entries/pages/time-entries.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,4 +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 {
event.source._dragRef.reset();
}
}