|
@@ -1,16 +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 |
path: 'home',
|
| 11 |
-
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
},
|
| 14 |
-
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
| 16 |
];
|
|
|
|
| 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,9 +3,9 @@ import { Routes } from '@angular/router';
|
|
| 3 |
import { BookCreatePage } from './book-create-page/book-create-page';
|
| 4 |
|
| 5 |
export const booksAdminRoutes: Routes = [
|
| 6 |
-
{ path: '
|
| 7 |
{
|
| 8 |
-
path: '
|
| 9 |
component: BookCreatePage,
|
| 10 |
title: 'Create Book'
|
| 11 |
},
|
|
|
|
| 3 |
import { BookCreatePage } from './book-create-page/book-create-page';
|
| 4 |
|
| 5 |
export const booksAdminRoutes: Routes = [
|
| 6 |
+
{ path: '', redirectTo: 'create', pathMatch: 'full' },
|
| 7 |
{
|
| 8 |
+
path: 'create',
|
| 9 |
component: BookCreatePage,
|
| 10 |
title: 'Create Book'
|
| 11 |
},
|
|
@@ -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 () => {
|
|
@@ -115,7 +115,7 @@ describe('BooksOverviewPage', () => {
|
|
| 115 |
|
| 116 |
it('should load BooksOverviewPage for /books', async () => {
|
| 117 |
const harness = await RouterTestingHarness.create();
|
| 118 |
-
const component = await harness.navigateByUrl('/
|
| 119 |
|
| 120 |
expect(component).toBeTruthy();
|
| 121 |
expect(document.title).toBe('Books');
|
|
|
|
| 115 |
|
| 116 |
it('should load BooksOverviewPage for /books', async () => {
|
| 117 |
const harness = await RouterTestingHarness.create();
|
| 118 |
+
const component = await harness.navigateByUrl('/', BooksOverviewPage);
|
| 119 |
|
| 120 |
expect(component).toBeTruthy();
|
| 121 |
expect(document.title).toBe('Books');
|
|
@@ -5,12 +5,12 @@ import { BookDetailsPage } from './book-details-page/book-details-page';
|
|
| 5 |
|
| 6 |
export const booksPortalRoutes: Routes = [
|
| 7 |
{
|
| 8 |
-
path: '
|
| 9 |
component: BooksOverviewPage,
|
| 10 |
title: 'Books'
|
| 11 |
},
|
| 12 |
{
|
| 13 |
-
path: '
|
| 14 |
component: BookDetailsPage,
|
| 15 |
title: 'Book Details'
|
| 16 |
},
|
|
|
|
| 5 |
|
| 6 |
export const booksPortalRoutes: Routes = [
|
| 7 |
{
|
| 8 |
+
path: '',
|
| 9 |
component: BooksOverviewPage,
|
| 10 |
title: 'Books'
|
| 11 |
},
|
| 12 |
{
|
| 13 |
+
path: 'details/:isbn',
|
| 14 |
component: BookDetailsPage,
|
| 15 |
title: 'Book Details'
|
| 16 |
},
|