From 1f93dfc6e76f3ac0ba3fe6f8a9432e68747807ce Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 1 Aug 2020 16:35:53 +0000 Subject: [PATCH 1/3] chore(deps): bump elliptic from 6.5.2 to 6.5.3 Bumps [elliptic](https://github.com/indutny/elliptic) from 6.5.2 to 6.5.3. - [Release notes](https://github.com/indutny/elliptic/releases) - [Commits](https://github.com/indutny/elliptic/compare/v6.5.2...v6.5.3) Signed-off-by: dependabot[bot] --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index b76d033a7..afdf5fb40 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6787,9 +6787,9 @@ "dev": true }, "elliptic": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.2.tgz", - "integrity": "sha512-f4x70okzZbIQl/NSRLkI/+tteV/9WqL98zx+SQ69KbXxmVrmjwsNUPn/gYJJ0sHvEak24cZgHIPegRePAtA/xw==", + "version": "6.5.3", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.3.tgz", + "integrity": "sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw==", "dev": true, "requires": { "bn.js": "^4.4.0", From c5ec31c6ab59d19565ee2c075f89f0b116faf33e Mon Sep 17 00:00:00 2001 From: roberto Date: Thu, 30 Jul 2020 09:56:06 -0500 Subject: [PATCH 2/3] fix: refresh active entry on edit actions #481 --- src/app/modules/time-entries/pages/time-entries.component.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/app/modules/time-entries/pages/time-entries.component.ts b/src/app/modules/time-entries/pages/time-entries.component.ts index 054fddccf..ecef9a60e 100644 --- a/src/app/modules/time-entries/pages/time-entries.component.ts +++ b/src/app/modules/time-entries/pages/time-entries.component.ts @@ -46,6 +46,7 @@ export class TimeEntriesComponent implements OnInit, OnDestroy { ) ) ).subscribe((action) => { + this.loadActiveEntry(); this.store.dispatch(new entryActions.LoadEntries(new Date().getMonth() + 1)); }); } @@ -126,6 +127,8 @@ export class TimeEntriesComponent implements OnInit, OnDestroy { this.store.pipe(select(getActiveTimeEntry)).subscribe((activeTimeEntry) => { if (activeTimeEntry) { this.activeTimeEntry = activeTimeEntry; + } else { + this.activeTimeEntry = null; } }); } From c934b915aa7bdd05f0afd97fd5640201eceaaade Mon Sep 17 00:00:00 2001 From: roberto Date: Mon, 3 Aug 2020 13:59:22 -0500 Subject: [PATCH 3/3] test: add unit tests #481 --- .../pages/time-entries.component.spec.ts | 26 +++++++++++++++++-- .../pages/time-entries.component.ts | 6 +---- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/src/app/modules/time-entries/pages/time-entries.component.spec.ts b/src/app/modules/time-entries/pages/time-entries.component.spec.ts index f5008fde0..f47e226e2 100644 --- a/src/app/modules/time-entries/pages/time-entries.component.spec.ts +++ b/src/app/modules/time-entries/pages/time-entries.component.spec.ts @@ -11,10 +11,11 @@ import { TechnologyState } from '../../shared/store/technology.reducers'; import { TimeEntriesSummaryComponent } from '../../time-clock/components/time-entries-summary/time-entries-summary.component'; import * as entryActions from '../../time-clock/store/entry.actions'; import { EntryState } from '../../time-clock/store/entry.reducer'; -import { getTimeEntriesDataSource } from '../../time-clock/store/entry.selectors'; +import { getTimeEntriesDataSource, getActiveTimeEntry } from '../../time-clock/store/entry.selectors'; import { LoadActiveEntry } from './../../time-clock/store/entry.actions'; import { TimeEntriesComponent } from './time-entries.component'; - +import { ActionsSubject } from '@ngrx/store'; +import { EntryActionTypes } from './../../time-clock/store/entry.actions'; describe('TimeEntriesComponent', () => { type Merged = TechnologyState & ProjectState & EntryState; @@ -179,6 +180,27 @@ describe('TimeEntriesComponent', () => { expect(component.entryId).toBe(anEntryId); }); + it('when trigger edit action and there is no active entry, active entry should be null', () => { + state.active = null; + mockEntriesSelector = store.overrideSelector(getActiveTimeEntry, state.active); + + const actionSubject = TestBed.inject(ActionsSubject) as ActionsSubject; + const action = { + type: EntryActionTypes.UPDATE_ENTRY_SUCCESS, + payload: { + project_id: 'project-id', + start_date: '2010-05-05T10:04', + description: 'description', + technologies: [], + uri: 'abc', + }, + }; + + actionSubject.next(action); + + expect(component.activeTimeEntry).toBeNull(); + }); + it('given a list of entries having an entry running when editing a different entry it cannot be marked as WIP ', () => { const anEntryId = '1'; const anotherEntryId = '2'; diff --git a/src/app/modules/time-entries/pages/time-entries.component.ts b/src/app/modules/time-entries/pages/time-entries.component.ts index ecef9a60e..cb8c984ca 100644 --- a/src/app/modules/time-entries/pages/time-entries.component.ts +++ b/src/app/modules/time-entries/pages/time-entries.component.ts @@ -125,11 +125,7 @@ export class TimeEntriesComponent implements OnInit, OnDestroy { loadActiveEntry() { this.store.dispatch(new entryActions.LoadActiveEntry()); this.store.pipe(select(getActiveTimeEntry)).subscribe((activeTimeEntry) => { - if (activeTimeEntry) { - this.activeTimeEntry = activeTimeEntry; - } else { - this.activeTimeEntry = null; - } + this.activeTimeEntry = activeTimeEntry; }); }