From 276677bed8e2c3b11d23ecd1a8183afbe14a2488 Mon Sep 17 00:00:00 2001 From: insanity Date: Thu, 25 Jan 2018 18:38:02 +0900 Subject: [PATCH] Route testing --- src/app/app-routing.module.ts | 4 ++- src/app/app.component.html | 20 --------------- src/app/app.module.ts | 4 +-- src/app/pages/auth/auth.component.html | 4 +++ src/app/pages/auth/auth.component.scss | 0 src/app/pages/auth/auth.component.spec.ts | 25 +++++++++++++++++++ src/app/pages/auth/auth.component.ts | 15 +++++++++++ src/app/pages/auth/auth.module.ts | 22 ++++++++++++++++ .../pages/auth/signin/signin.component.html | 3 +++ .../pages/auth/signin/signin.component.scss | 0 .../auth/signin/signin.component.spec.ts | 25 +++++++++++++++++++ src/app/pages/auth/signin/signin.component.ts | 15 +++++++++++ src/app/pages/auth/signin/signin.module.ts | 21 ++++++++++++++++ 13 files changed, 134 insertions(+), 24 deletions(-) create mode 100644 src/app/pages/auth/auth.component.html create mode 100644 src/app/pages/auth/auth.component.scss create mode 100644 src/app/pages/auth/auth.component.spec.ts create mode 100644 src/app/pages/auth/auth.component.ts create mode 100644 src/app/pages/auth/auth.module.ts create mode 100644 src/app/pages/auth/signin/signin.component.html create mode 100644 src/app/pages/auth/signin/signin.component.scss create mode 100644 src/app/pages/auth/signin/signin.component.spec.ts create mode 100644 src/app/pages/auth/signin/signin.component.ts create mode 100644 src/app/pages/auth/signin/signin.module.ts diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index d425c6f..7f29d5d 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -1,7 +1,9 @@ import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; -const routes: Routes = []; +const routes: Routes = [ + { path: 'auth', loadChildren: './pages/auth/auth.module#AuthModule' }, +]; @NgModule({ imports: [RouterModule.forRoot(routes)], diff --git a/src/app/app.component.html b/src/app/app.component.html index 1094e7e..0680b43 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -1,21 +1 @@ - -
-

- Welcome to {{ title }}! -

- Angular Logo -
-

Here are some links to help you start:

- - diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 0e5282b..0440fa4 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -7,8 +7,7 @@ import { AppRoutingModule } from './app-routing.module'; import { AppComponent } from './app.component'; import { MaterialModule } from './commons/ui/material/material.module'; - -import { MemberModule } from 'app/packages/member/member.module'; +import { AuthComponent } from './pages/auth/auth.component'; @NgModule({ declarations: [ @@ -19,7 +18,6 @@ import { MemberModule } from 'app/packages/member/member.module'; BrowserAnimationsModule, AppRoutingModule, MaterialModule, - MemberModule, ], providers: [], bootstrap: [AppComponent] diff --git a/src/app/pages/auth/auth.component.html b/src/app/pages/auth/auth.component.html new file mode 100644 index 0000000..cd5defa --- /dev/null +++ b/src/app/pages/auth/auth.component.html @@ -0,0 +1,4 @@ +

+ auth works! +

+ \ No newline at end of file diff --git a/src/app/pages/auth/auth.component.scss b/src/app/pages/auth/auth.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/pages/auth/auth.component.spec.ts b/src/app/pages/auth/auth.component.spec.ts new file mode 100644 index 0000000..884576c --- /dev/null +++ b/src/app/pages/auth/auth.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { AuthComponent } from './auth.component'; + +describe('AuthComponent', () => { + let component: AuthComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ AuthComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(AuthComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/pages/auth/auth.component.ts b/src/app/pages/auth/auth.component.ts new file mode 100644 index 0000000..9637ce3 --- /dev/null +++ b/src/app/pages/auth/auth.component.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'of-auth', + templateUrl: './auth.component.html', + styleUrls: ['./auth.component.scss'] +}) +export class AuthComponent implements OnInit { + + constructor() { } + + ngOnInit() { + } + +} diff --git a/src/app/pages/auth/auth.module.ts b/src/app/pages/auth/auth.module.ts new file mode 100644 index 0000000..cabd1c1 --- /dev/null +++ b/src/app/pages/auth/auth.module.ts @@ -0,0 +1,22 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { RouterModule, Routes } from '@angular/router'; +import { AuthComponent } from 'app/pages/auth/auth.component'; + +export const appRoutes: Routes = [{ + path: '', component: AuthComponent, children: [ + { path: 'signin', loadChildren: './signin/signin.module#SigninModule' }, + ] +} +]; + +@NgModule({ + imports: [ + CommonModule, + RouterModule.forChild(appRoutes), + ], + declarations: [ + AuthComponent + ] +}) +export class AuthModule { } diff --git a/src/app/pages/auth/signin/signin.component.html b/src/app/pages/auth/signin/signin.component.html new file mode 100644 index 0000000..21a29bd --- /dev/null +++ b/src/app/pages/auth/signin/signin.component.html @@ -0,0 +1,3 @@ +

+ signin works! +

diff --git a/src/app/pages/auth/signin/signin.component.scss b/src/app/pages/auth/signin/signin.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/pages/auth/signin/signin.component.spec.ts b/src/app/pages/auth/signin/signin.component.spec.ts new file mode 100644 index 0000000..c64b0b2 --- /dev/null +++ b/src/app/pages/auth/signin/signin.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { SigninComponent } from './signin.component'; + +describe('SigninComponent', () => { + let component: SigninComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ SigninComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(SigninComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/pages/auth/signin/signin.component.ts b/src/app/pages/auth/signin/signin.component.ts new file mode 100644 index 0000000..eeb1275 --- /dev/null +++ b/src/app/pages/auth/signin/signin.component.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'of-signin', + templateUrl: './signin.component.html', + styleUrls: ['./signin.component.scss'] +}) +export class SigninComponent implements OnInit { + + constructor() { } + + ngOnInit() { + } + +} diff --git a/src/app/pages/auth/signin/signin.module.ts b/src/app/pages/auth/signin/signin.module.ts new file mode 100644 index 0000000..f51cb54 --- /dev/null +++ b/src/app/pages/auth/signin/signin.module.ts @@ -0,0 +1,21 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { SigninComponent } from './signin.component'; +import { Routes, RouterModule } from '@angular/router'; + +const routes: Routes = [ + { path: '', component: SigninComponent }, +]; + +@NgModule({ + imports: [ + CommonModule + ], + declarations: [ + SigninComponent + ], + exports: [ + RouterModule, + ] +}) +export class SigninModule { }