mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 18:14:17 +00:00
dependency upgrades, server and platform module updates, linting wip
This commit is contained in:
33
src/app/shared/testing/active-router-stub.ts
Normal file
33
src/app/shared/testing/active-router-stub.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import { Params } from '@angular/router';
|
||||
|
||||
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
|
||||
|
||||
export class ActivatedRouteStub {
|
||||
|
||||
// ActivatedRoute.params is Observable
|
||||
private subject = new BehaviorSubject(this.testParams);
|
||||
params = this.subject.asObservable();
|
||||
queryParams = this.subject.asObservable();
|
||||
|
||||
private _testParams: {};
|
||||
|
||||
constructor(params?: Params) {
|
||||
if (params) {
|
||||
this.testParams = params;
|
||||
} else {
|
||||
this.testParams = {};
|
||||
}
|
||||
}
|
||||
|
||||
// Test parameters
|
||||
get testParams() { return this._testParams; }
|
||||
set testParams(params: {}) {
|
||||
this._testParams = params;
|
||||
this.subject.next(params);
|
||||
}
|
||||
|
||||
// ActivatedRoute.snapshot.params
|
||||
get snapshot() {
|
||||
return { params: this.testParams };
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user