|
@@ -1,12 +1,21 @@
|
|
| 1 |
import { Routes } from '@angular/router';
|
| 2 |
|
| 3 |
-
import { HomePage } from './home-page/home-page';
|
| 4 |
-
import { booksPortalRoutes } from './books-portal/books-portal.routes';
|
| 5 |
-
import { booksAdminRoutes } from './books-admin/books-admin.routes';
|
| 6 |
-
|
| 7 |
export const routes: Routes = [
|
| 8 |
{ path: '', redirectTo: 'home', pathMatch: 'full' },
|
| 9 |
-
{
|
| 10 |
-
|
| 11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
];
|
|
|
|
| 1 |
import { Routes } from '@angular/router';
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
export const routes: Routes = [
|
| 4 |
{ path: '', redirectTo: 'home', pathMatch: 'full' },
|
| 5 |
+
{
|
| 6 |
+
path: 'home',
|
| 7 |
+
title: 'BookManager',
|
| 8 |
+
loadComponent: () => import('./home-page/home-page')
|
| 9 |
+
.then(m => m.HomePage)
|
| 10 |
+
},
|
| 11 |
+
{
|
| 12 |
+
path: 'books',
|
| 13 |
+
loadChildren: () => import('./books-portal/books-portal.routes')
|
| 14 |
+
.then(m => m.booksPortalRoutes)
|
| 15 |
+
},
|
| 16 |
+
{
|
| 17 |
+
path: 'admin',
|
| 18 |
+
loadChildren: () => import('./books-admin/books-admin.routes')
|
| 19 |
+
.then(m => m.booksAdminRoutes)
|
| 20 |
+
}
|
| 21 |
];
|
|
@@ -3,6 +3,6 @@ import { Routes } from '@angular/router';
|
|
| 3 |
import { BookCreatePage } from './book-create-page/book-create-page';
|
| 4 |
|
| 5 |
export const booksAdminRoutes: Routes = [
|
| 6 |
-
{ path: '
|
| 7 |
-
{ path: '
|
| 8 |
];
|
|
|
|
| 3 |
import { BookCreatePage } from './book-create-page/book-create-page';
|
| 4 |
|
| 5 |
export const booksAdminRoutes: Routes = [
|
| 6 |
+
{ path: '', redirectTo: 'create', pathMatch: 'full' },
|
| 7 |
+
{ path: 'create', component: BookCreatePage, title: 'Create Book' }
|
| 8 |
];
|
|
@@ -61,9 +61,9 @@ describe('BookDetailsPage', () => {
|
|
| 61 |
const location = TestBed.inject(Location);
|
| 62 |
const router = TestBed.inject(Router);
|
| 63 |
|
| 64 |
-
await router.navigate(['/
|
| 65 |
|
| 66 |
-
expect(location.path()).toBe('/
|
| 67 |
});
|
| 68 |
|
| 69 |
it('should update the book when ISBN changes', async () => {
|
|
|
|
| 61 |
const location = TestBed.inject(Location);
|
| 62 |
const router = TestBed.inject(Router);
|
| 63 |
|
| 64 |
+
await router.navigate(['/details/12345']);
|
| 65 |
|
| 66 |
+
expect(location.path()).toBe('/details/12345');
|
| 67 |
});
|
| 68 |
|
| 69 |
it('should update the book when ISBN changes', async () => {
|
|
@@ -85,7 +85,7 @@ describe('BooksOverviewPage', () => {
|
|
| 85 |
|
| 86 |
it('should load the BooksOverviewPage for /books', async () => {
|
| 87 |
const harness = await RouterTestingHarness.create();
|
| 88 |
-
const component = await harness.navigateByUrl('/
|
| 89 |
|
| 90 |
expect(component).toBeTruthy();
|
| 91 |
expect(document.title).toBe('Books');
|
|
|
|
| 85 |
|
| 86 |
it('should load the BooksOverviewPage for /books', async () => {
|
| 87 |
const harness = await RouterTestingHarness.create();
|
| 88 |
+
const component = await harness.navigateByUrl('/', BooksOverviewPage);
|
| 89 |
|
| 90 |
expect(component).toBeTruthy();
|
| 91 |
expect(document.title).toBe('Books');
|
|
@@ -4,6 +4,6 @@ import { BooksOverviewPage } from './books-overview-page/books-overview-page';
|
|
| 4 |
import { BookDetailsPage } from './book-details-page/book-details-page';
|
| 5 |
|
| 6 |
export const booksPortalRoutes: Routes = [
|
| 7 |
-
{ path: '
|
| 8 |
-
{ path: '
|
| 9 |
];
|
|
|
|
| 4 |
import { BookDetailsPage } from './book-details-page/book-details-page';
|
| 5 |
|
| 6 |
export const booksPortalRoutes: Routes = [
|
| 7 |
+
{ path: '', component: BooksOverviewPage, title: 'Books' },
|
| 8 |
+
{ path: 'details/:isbn', component: BookDetailsPage, title: 'Book Details' },
|
| 9 |
];
|