fix: avoid a lint error and fix some testing errors

pull/4849/head
mehmet-erim 5 years ago
parent 5ea30d4e66
commit 5cc0de966d

@ -60,7 +60,7 @@ export class PermissionDirective implements OnInit, OnDestroy, OnChanges {
}
ngOnDestroy(): void {
this.subscription.unsubscribe();
if (this.subscription) this.subscription.unsubscribe();
}
ngOnChanges({ condition }: SimpleChanges) {

@ -13,14 +13,9 @@ export class StopPropagationDirective implements OnInit {
constructor(private el: ElementRef, private subscription: SubscriptionService) {}
ngOnInit(): void {
const click$ = this.subscription.addOne(
fromEvent(this.el.nativeElement, 'click'),
(event: MouseEvent) => {
event.stopPropagation();
this.stopPropEvent.emit(event);
},
);
this.subscription.addOne(fromEvent(this.el.nativeElement, 'click'), (event: MouseEvent) => {
event.stopPropagation();
this.stopPropEvent.emit(event);
});
}
ngOnDestroy(): void {}
}

@ -21,6 +21,7 @@ import { filter } from 'rxjs/operators';
</div>
`,
styleUrls: ['./loader-bar.component.scss'],
providers: [SubscriptionService],
})
export class LoaderBarComponent implements OnDestroy, OnInit {
protected _isLoading: boolean;

@ -1,9 +1,15 @@
import { Router, RouteReuseStrategy, NavigationStart, NavigationEnd, NavigationError } from '@angular/router';
import {
Router,
RouteReuseStrategy,
NavigationStart,
NavigationEnd,
NavigationError,
} from '@angular/router';
import { createHostFactory, SpectatorHost, SpyObject } from '@ngneat/spectator/jest';
import { Actions, NgxsModule, Store } from '@ngxs/store';
import { Subject, Subscription, Observable, Subscriber, timer } from 'rxjs';
import { LoaderBarComponent } from '../components/loader-bar/loader-bar.component';
import { StartLoader, StopLoader } from '@abp/ng.core';
import { StartLoader, StopLoader, SubscriptionService } from '@abp/ng.core';
import { HttpRequest } from '@angular/common/http';
describe('LoaderBarComponent', () => {
@ -16,6 +22,7 @@ describe('LoaderBarComponent', () => {
mocks: [Router],
imports: [NgxsModule.forRoot()],
detectChanges: false,
providers: [SubscriptionService],
});
beforeEach(() => {

Loading…
Cancel
Save