mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-08 17:06:15 -08:00
refactor: improve routing behaviour, disable skipLocationChange
This commit is contained in:
3 files changed
+31
-34
No files matched your search
@@ -1,25 +1,25 @@
|
||||
import { NgxWhatsNewModule } from 'ngx-whats-new';
|
||||
import {
|
||||
ComponentFixture,
|
||||
inject,
|
||||
TestBed,
|
||||
waitForAsync,
|
||||
} from '@angular/core/testing';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { AppComponent } from './app.component';
|
||||
import { TranslatePipe, TranslateService } from '@ngx-translate/core';
|
||||
import { ElectronServiceStub } from './services/electron.service.stub';
|
||||
import { MatSnackBar, MatSnackBarModule } from '@angular/material/snack-bar';
|
||||
import { MockModule, MockPipe, MockProviders } from 'ng-mocks';
|
||||
import { of } from 'rxjs';
|
||||
import { WhatsNewService } from './services/whats-new.service';
|
||||
import { Theme } from './settings/theme.enum';
|
||||
import { SettingsService } from './services/settings.service';
|
||||
import { Router } from '@angular/router';
|
||||
import { ChannelStore } from './state';
|
||||
import { STORE_KEY } from './shared/enums/store-keys.enum';
|
||||
import { WhatsNewServiceStub } from './services/whats-new.service.stub';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { TranslatePipe, TranslateService } from '@ngx-translate/core';
|
||||
import { MockModule, MockPipe, MockProviders } from 'ng-mocks';
|
||||
import { NgxWhatsNewModule } from 'ngx-whats-new';
|
||||
import { of } from 'rxjs';
|
||||
import { AppComponent } from './app.component';
|
||||
import { DataService } from './services/data.service';
|
||||
import { ElectronServiceStub } from './services/electron.service.stub';
|
||||
import { SettingsService } from './services/settings.service';
|
||||
import { WhatsNewService } from './services/whats-new.service';
|
||||
import { WhatsNewServiceStub } from './services/whats-new.service.stub';
|
||||
import { Theme } from './settings/theme.enum';
|
||||
import { STORE_KEY } from './shared/enums/store-keys.enum';
|
||||
import { ChannelStore } from './state';
|
||||
|
||||
class MatSnackBarStub {
|
||||
open(): void {}
|
||||
@@ -113,10 +113,7 @@ describe('AppComponent', () => {
|
||||
jest.spyOn(router, 'navigateByUrl');
|
||||
component.navigateToRoute(route);
|
||||
expect(router.navigateByUrl).toHaveBeenCalledTimes(1);
|
||||
expect(router.navigateByUrl).toHaveBeenCalledWith(
|
||||
route,
|
||||
expect.anything()
|
||||
);
|
||||
expect(router.navigateByUrl).toHaveBeenCalledWith(route);
|
||||
}
|
||||
));
|
||||
|
||||
|
||||
@@ -201,7 +201,7 @@ export class AppComponent {
|
||||
* @param route route to navigate to
|
||||
*/
|
||||
navigateToRoute(route: string) {
|
||||
this.router.navigateByUrl(route, { skipLocationChange: true });
|
||||
this.router.navigateByUrl(route);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FormGroup, FormBuilder } from '@angular/forms';
|
||||
import { StorageMap } from '@ngx-pwa/local-storage';
|
||||
import { Router } from '@angular/router';
|
||||
import { MatSnackBar } from '@angular/material/snack-bar';
|
||||
import { Observable } from 'rxjs';
|
||||
import { STORE_KEY } from '../shared/enums/store-keys.enum';
|
||||
import { Settings, VideoPlayer } from './settings.interface';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import * as semver from 'semver';
|
||||
import { ChannelQuery } from '../state';
|
||||
import { EPG_FETCH } from '../../../shared/ipc-commands';
|
||||
import { Language } from './language.enum';
|
||||
import { Theme } from './theme.enum';
|
||||
import { SettingsService } from './../services/settings.service';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FormBuilder, FormGroup } from '@angular/forms';
|
||||
import { MatSnackBar } from '@angular/material/snack-bar';
|
||||
import { Router } from '@angular/router';
|
||||
import { StorageMap } from '@ngx-pwa/local-storage';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { Observable } from 'rxjs';
|
||||
import { catchError } from 'rxjs/operators';
|
||||
import * as semver from 'semver';
|
||||
import { EPG_FETCH } from '../../../shared/ipc-commands';
|
||||
import { DataService } from '../services/data.service';
|
||||
import { STORE_KEY } from '../shared/enums/store-keys.enum';
|
||||
import { ChannelQuery } from '../state';
|
||||
import { SettingsService } from './../services/settings.service';
|
||||
import { Language } from './language.enum';
|
||||
import { Settings, VideoPlayer } from './settings.interface';
|
||||
import { Theme } from './theme.enum';
|
||||
|
||||
/** Url of the package.json file in the app repository, required to get the version of the released app */
|
||||
const PACKAGE_JSON_URL =
|
||||
@@ -205,7 +205,7 @@ export class SettingsComponent implements OnInit {
|
||||
* Navigates back to the applications homepage
|
||||
*/
|
||||
backToHome(): void {
|
||||
this.router.navigateByUrl('/', { skipLocationChange: true });
|
||||
this.router.navigateByUrl('/');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user