Add a new Angular app with 4 components

This commit is contained in:
Sébastien André
2019-09-17 13:48:16 +02:00
parent d9a79ebe0f
commit e79ac82861
47 changed files with 13521 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
<nav>
<a routerLink="/summary" routerLinkActive="active">Summary</a>
<a routerLink="/jumpsList" routerLinkActive="active">List of jumps</a>
<a routerLink="/dz" routerLinkActive="active">List of DZs</a>
<a routerLink="/newjump" routerLinkActive="active">Add a new jumps</a>
</nav>
<router-outlet></router-outlet>

View File

@@ -0,0 +1,27 @@
import { TestBed, async } from '@angular/core/testing';
import { AppComponent } from './app.component';
describe('AppComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [
AppComponent
],
}).compileComponents();
}));
it('should create the app', async(() => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
}));
it(`should have as title 'app'`, async(() => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app.title).toEqual('app');
}));
it('should render title in a h1 tag', async(() => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.debugElement.nativeElement;
expect(compiled.querySelector('h1').textContent).toContain('Welcome to app!');
}));
});

View File

@@ -0,0 +1,10 @@
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'app';
}

View File

@@ -0,0 +1,49 @@
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { AppComponent } from './app.component';
import { SummaryComponent } from './summary/summary.component';
import { ListOfJumpsComponent } from './list-of-jumps/list-of-jumps.component';
import { ListOfDzsComponent } from './list-of-dzs/list-of-dzs.component';
import { NewJumpComponent } from './new-jump/new-jump.component';
const appRoutes: Routes = [
{ path: 'summary', component: SummaryComponent },
{ path: 'jumpsList', component: ListOfJumpsComponent },
{ path: 'dz', component: ListOfDzsComponent },
{ path: 'newjump', component: NewJumpComponent }
// { path: 'hero/:id', component: HeroDetailComponent },
// {
// path: 'heroes',
// component: HeroListComponent,
// data: { title: 'Heroes List' }
// },
// { path: '',
// redirectTo: '/heroes',
// pathMatch: 'full'
// },
// { path: '**', component: PageNotFoundComponent }
];
@NgModule({
declarations: [
AppComponent,
SummaryComponent,
ListOfJumpsComponent,
ListOfDzsComponent,
NewJumpComponent
],
imports: [
RouterModule.forRoot(
appRoutes,
{ enableTracing: true } // <-- debugging purposes only
),
BrowserModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }

View File

@@ -0,0 +1,3 @@
<p>
list-of-dzs works!
</p>

View File

@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ListOfDzsComponent } from './list-of-dzs.component';
describe('ListOfDzsComponent', () => {
let component: ListOfDzsComponent;
let fixture: ComponentFixture<ListOfDzsComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ListOfDzsComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ListOfDzsComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-list-of-dzs',
templateUrl: './list-of-dzs.component.html',
styleUrls: ['./list-of-dzs.component.css']
})
export class ListOfDzsComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}

View File

@@ -0,0 +1,3 @@
<p>
list-of-jumps works!
</p>

View File

@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ListOfJumpsComponent } from './list-of-jumps.component';
describe('ListOfJumpsComponent', () => {
let component: ListOfJumpsComponent;
let fixture: ComponentFixture<ListOfJumpsComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ListOfJumpsComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ListOfJumpsComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-list-of-jumps',
templateUrl: './list-of-jumps.component.html',
styleUrls: ['./list-of-jumps.component.css']
})
export class ListOfJumpsComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}

View File

@@ -0,0 +1,3 @@
<p>
new-jump works!
</p>

View File

@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { NewJumpComponent } from './new-jump.component';
describe('NewJumpComponent', () => {
let component: NewJumpComponent;
let fixture: ComponentFixture<NewJumpComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ NewJumpComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(NewJumpComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-new-jump',
templateUrl: './new-jump.component.html',
styleUrls: ['./new-jump.component.css']
})
export class NewJumpComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}

View File

@@ -0,0 +1,3 @@
<p>
summary works!
</p>

View File

@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { SummaryComponent } from './summary.component';
describe('SummaryComponent', () => {
let component: SummaryComponent;
let fixture: ComponentFixture<SummaryComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ SummaryComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(SummaryComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-summary',
templateUrl: './summary.component.html',
styleUrls: ['./summary.component.css']
})
export class SummaryComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}