From 63ec1e139f01aba4360d72d786329a8be28d5e05 Mon Sep 17 00:00:00 2001
From: anandtiwary <52081890+anandtiwary@users.noreply.github.com>
Date: Tue, 8 Jun 2021 15:27:30 -0700
Subject: [PATCH 1/4] refactor: fixing disabled behavior for htlink
---
projects/common/src/navigation/navigation.service.ts | 5 ++---
projects/components/src/link/link.component.test.ts | 6 ++++--
projects/components/src/link/link.component.ts | 3 +--
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/projects/common/src/navigation/navigation.service.ts b/projects/common/src/navigation/navigation.service.ts
index 734576231..d378b6cdc 100644
--- a/projects/common/src/navigation/navigation.service.ts
+++ b/projects/common/src/navigation/navigation.service.ts
@@ -14,7 +14,7 @@ import {
UrlTree
} from '@angular/router';
import { from, Observable, of } from 'rxjs';
-import { distinctUntilChanged, filter, map, share, skip, startWith, take } from 'rxjs/operators';
+import { filter, map, share, skip, startWith, take } from 'rxjs/operators';
import { throwIfNil } from '../utilities/lang/lang-utils';
import { Dictionary } from '../utilities/types/types';
import { TraceRoute } from './trace-route';
@@ -190,8 +190,7 @@ export class NavigationService {
return this.router.events.pipe(
startWith(),
- map(() => this.router.isActive(urlTree, false)),
- distinctUntilChanged()
+ map(() => this.router.isActive(urlTree, false))
);
}
diff --git a/projects/components/src/link/link.component.test.ts b/projects/components/src/link/link.component.test.ts
index 4d08f5648..6e2161d37 100644
--- a/projects/components/src/link/link.component.test.ts
+++ b/projects/components/src/link/link.component.test.ts
@@ -13,14 +13,16 @@ describe('Link component', () => {
declarations: [MockDirective(RouterLinkWithHref)]
});
- test('Link should not be displayed if url is undefined', () => {
+ test('Link contents should be displayed if params/url is undefined', () => {
spectator = createHost(``, {
props: {
paramsOrUrl: undefined
}
});
- expect(spectator.query('.ht-link')).not.toExist();
+ const anchorElement = spectator.query('.ht-link');
+ expect(anchorElement).toExist();
+ expect(anchorElement).toHaveClass('ht-link disabled');
});
test('Link should navigate correctly to external URLs', () => {
diff --git a/projects/components/src/link/link.component.ts b/projects/components/src/link/link.component.ts
index 9a58b868a..51291eaab 100644
--- a/projects/components/src/link/link.component.ts
+++ b/projects/components/src/link/link.component.ts
@@ -9,9 +9,8 @@ import { isNil } from 'lodash-es';
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
Date: Tue, 8 Jun 2021 15:28:56 -0700
Subject: [PATCH 2/4] revert: revert navigation service changes
---
projects/common/src/navigation/navigation.service.ts | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/projects/common/src/navigation/navigation.service.ts b/projects/common/src/navigation/navigation.service.ts
index d378b6cdc..734576231 100644
--- a/projects/common/src/navigation/navigation.service.ts
+++ b/projects/common/src/navigation/navigation.service.ts
@@ -14,7 +14,7 @@ import {
UrlTree
} from '@angular/router';
import { from, Observable, of } from 'rxjs';
-import { filter, map, share, skip, startWith, take } from 'rxjs/operators';
+import { distinctUntilChanged, filter, map, share, skip, startWith, take } from 'rxjs/operators';
import { throwIfNil } from '../utilities/lang/lang-utils';
import { Dictionary } from '../utilities/types/types';
import { TraceRoute } from './trace-route';
@@ -190,7 +190,8 @@ export class NavigationService {
return this.router.events.pipe(
startWith(),
- map(() => this.router.isActive(urlTree, false))
+ map(() => this.router.isActive(urlTree, false)),
+ distinctUntilChanged()
);
}
From c194d3232257e6c3247519fcc220a44d3203975b Mon Sep 17 00:00:00 2001
From: anandtiwary <52081890+anandtiwary@users.noreply.github.com>
Date: Tue, 8 Jun 2021 15:41:06 -0700
Subject: [PATCH 3/4] refactor: updating condition
---
projects/components/src/link/link.component.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/projects/components/src/link/link.component.ts b/projects/components/src/link/link.component.ts
index 51291eaab..02cfb3712 100644
--- a/projects/components/src/link/link.component.ts
+++ b/projects/components/src/link/link.component.ts
@@ -10,7 +10,7 @@ import { isNil } from 'lodash-es';
template: `
Date: Tue, 8 Jun 2021 15:58:18 -0700
Subject: [PATCH 4/4] refactor: fix lint issue
---
projects/components/src/link/link.component.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/projects/components/src/link/link.component.ts b/projects/components/src/link/link.component.ts
index 02cfb3712..33d4c9164 100644
--- a/projects/components/src/link/link.component.ts
+++ b/projects/components/src/link/link.component.ts
@@ -10,7 +10,7 @@ import { isNil } from 'lodash-es';
template: `