Skip to content
This repository was archived by the owner on Oct 1, 2018. It is now read-only.

Commit ac8a90e

Browse files
committed
fix(operators): Debug lettable operators and remove dead code
1 parent 3774515 commit ac8a90e

File tree

3 files changed

+15
-41
lines changed

3 files changed

+15
-41
lines changed

src/app/operators/components/operator/operator.component.ts

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,20 @@ export class OperatorComponent implements OnInit {
3232
) {}
3333

3434
ngOnInit() {
35-
this._activatedRoute.params.pluck('operator').subscribe((name: string) => {
36-
this.operator =
37-
this.operators.filter(
38-
(operator: OperatorDoc) => operator.name === name
39-
)[0] || this.notfound();
40-
this._seo.setHeaders(
41-
[this.operator.name, this.operator.operatorType],
42-
this.operator.shortDescription
43-
? this.operator.shortDescription.description
44-
: ''
45-
);
46-
});
35+
this._activatedRoute.params
36+
.pipe(pluck('operator'))
37+
.subscribe((name: string) => {
38+
this.operator =
39+
this.operators.filter(
40+
(operator: OperatorDoc) => operator.name === name
41+
)[0] || this.notfound();
42+
this._seo.setHeaders(
43+
[this.operator.name, this.operator.operatorType],
44+
this.operator.shortDescription
45+
? this.operator.shortDescription.description
46+
: ''
47+
);
48+
});
4749
}
4850

4951
get operatorName() {

src/app/operators/operators.component.ts

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import {
33
Inject,
44
InjectionToken,
55
OnInit,
6-
AfterViewInit,
76
ChangeDetectionStrategy
87
} from '@angular/core';
98
import {
@@ -55,14 +54,12 @@ interface OperatorDocMap {
5554
])
5655
]
5756
})
58-
export class OperatorsComponent implements OnInit, AfterViewInit {
57+
export class OperatorsComponent implements OnInit {
5958
public groupedOperators: OperatorDocMap;
6059
public categories: string[];
6160

6261
constructor(
6362
private _breakpointObserver: BreakpointObserver,
64-
private _router: Router,
65-
private _activatedRoute: ActivatedRoute,
6663
@Inject(OPERATORS_TOKEN) public operators: OperatorDoc[],
6764
private _seo: SeoService
6865
) {}
@@ -73,24 +70,6 @@ export class OperatorsComponent implements OnInit, AfterViewInit {
7370
this._seo.setHeaders(['Operators'], this._seo.operatorsDescription);
7471
}
7572

76-
ngAfterViewInit() {
77-
// scroll initial param when applicable
78-
const name = this._activatedRoute.snapshot.fragment;
79-
80-
if (name) {
81-
// slight delay for scroll to be accurate
82-
setTimeout(() => this.scrollToOperator(name), 100);
83-
}
84-
}
85-
86-
scrollToOperator(name: string) {
87-
const element = document.getElementById(name);
88-
89-
if (element) {
90-
element.scrollIntoView();
91-
}
92-
}
93-
9473
get extraSmallScreen() {
9574
return this._breakpointObserver.isMatched('(max-width: 601px)');
9675
}

src/app/operators/specs/operators.spec.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,6 @@ describe('Operators', () => {
6464
expect(component.groupedOperators['utility'].length).toBe(2);
6565
});
6666

67-
it('should scroll to initial operator when fragment exists', () => {
68-
spyOn(component, 'scrollToOperator').and.stub();
69-
component.ngOnInit();
70-
71-
expect(component.scrollToOperator).toHaveBeenCalledWith('merge');
72-
});
73-
7467
it('should have a sidenav mode of over when on a small screen', () => {
7568
spyOn(breakpointService, 'isMatched').and.returnValue(true);
7669

0 commit comments

Comments
 (0)