Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
TDD Angular Workshop
Search
Pablo Villoslada Puigcerber
May 15, 2018
Programming
0
100
TDD Angular Workshop
Pablo Villoslada Puigcerber
May 15, 2018
Tweet
Share
More Decks by Pablo Villoslada Puigcerber
See All by Pablo Villoslada Puigcerber
Angular on Fire!
puigcerber
0
66
Introducción a Angular 2
puigcerber
0
66
Introduction to AngularJS
puigcerber
0
49
AngularJS en una hora
puigcerber
0
97
Other Decks in Programming
See All in Programming
CSC307 Lecture 05
javiergs
PRO
0
500
QAフローを最適化し、品質水準を満たしながらリリースまでの期間を最短化する #RSGT2026
shibayu36
2
4.3k
Fluid Templating in TYPO3 14
s2b
0
130
AIエージェント、”どう作るか”で差は出るか? / AI Agents: Does the "How" Make a Difference?
rkaga
4
2k
今こそ知るべき耐量子計算機暗号(PQC)入門 / PQC: What You Need to Know Now
mackey0225
3
370
Lambda のコードストレージ容量に気をつけましょう
tattwan718
0
110
プロダクトオーナーから見たSOC2 _SOC2ゆるミートアップ#2
kekekenta
0
200
ぼくの開発環境2026
yuzneri
0
110
登壇資料を作る時に意識していること #登壇資料_findy
konifar
4
980
疑似コードによるプロンプト記述、どのくらい正確に実行される?
kokuyouwind
0
380
360° Signals in Angular: Signal Forms with SignalStore & Resources @ngLondon 01/2026
manfredsteyer
PRO
0
120
カスタマーサクセス業務を変革したヘルススコアの実現と学び
_hummer0724
0
650
Featured
See All Featured
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
61k
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
1.8k
Reality Check: Gamification 10 Years Later
codingconduct
0
2k
The Curious Case for Waylosing
cassininazir
0
230
Docker and Python
trallard
47
3.7k
Designing for Performance
lara
610
70k
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
580
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
34k
How to make the Groovebox
asonas
2
1.9k
The Spectacular Lies of Maps
axbom
PRO
1
520
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
0
3.4k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
2.8k
Transcript
TDD Workshop Pablo Villoslada Puigcerber
https://speakerdeck.com/puigcerber https://github.com/Puigcerber/ tdd-angular-workshop
TypeScript
Static typed language function sayHello(name: string): string { return `Hello
${name}!`; } const person: object = {}; let age: number;
Class based programming class Angular { constructor() {} }
Decorators @Component({ selector: 'example-component', template: '<div>I am a component!</div>' })
class ExampleComponent { constructor() {} }
Components
Architecture <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head>
<body> <app-root></app-root> </body> </html>
Displaying data import { Component } from '@angular/core'; @Component({ selector:
'app-root', template: '<h1>{{title}}</h1>' }) export class AppComponent { title = 'TDD Workshop'; }
Lifecycle hooks class Lifecycle implements OnInit, OnDestroy { ngOnInit() {
console.log('on init'); } ngOnDestroy() { console.log('on destroy'); } }
Specs 1 to 4
Directives
Attribute directives <button type="button" class="btn" [ngClass]="{'btn-primary': true, 'btn-secondary': false}"> Send
</button>
Structural directives <ul *ngIf="items"> <li *ngFor="let item of items; index
as i"> {{ i }} - {{ item.name }} </li> </ul>
Pipes
Built-in pipes {{ a }}<!-- 0.189 --> {{ a |
currency }}<!-- $0.19 --> {{ a | currency:’EUR' }}<!-- €0.19 --> {{ a | currency:’USD':'code' }}<!-- USD0.19 -->
Specs 5 to 8
Services
@Injectable() import { Injectable } from '@angular/core'; @Injectable({ providedIn: MyModule,
}) export class InjectableService { }
Inject a service export class DIComponent { constructor(private http: HttpClient)
{ } ngOnInit() { this.http.get(''); } }
Observables
Subscribing const myObservable = Observable.of(1, 2, 3); myObservable.subscribe( x =>
console.log('Next value: ' + x), err => console.error('Error: ' + err), () => console.log('Complete!') );
RxJS Operators import { fromEvent } from 'rxjs'; import {
filter, map, tap } from 'rxjs/operators'; const subscription = fromEvent(document, 'keypress') .pipe( tap(console.log), filter(e => e.key === 'a'), map(e => e.keyCode) ).subscribe(console.log);
Specs 9 to 16
Router
Configuration export const routes: Routes = [ { path: 'main',
component: MainComponent } ]; @NgModule({ imports: [RouterModule.forRoot(routes) ], exports: [RouterModule] }) export class AppRoutingModule { }
Router directives <nav> <a routerLink="/items">Items</a> <a [routerLink]="['items', '1']">Item 1</a> </nav>
<router-outlet></router-outlet>
Activated route class RoutedComponent { constructor( private route: ActivatedRoute )
{ const id = route.paramMap.pipe( map((params: ParamMap) => params.get(('id'))) ); } }
Specs 17 to 21
Component interaction
Dumb component @Component({ selector: 'btn-dumb', template: `<button (click)="onClick()">{{label}}</button>` }) export
class DumbComponent{ @Input() label; @Output() dumb = new EventEmitter(); onClick() { this.dumb.emit('dumb'); } }
Smart component @Component({ selector: 'smart', template: ` <btn-dumb [label]="label" (dumb)="onDumb($event)">
</btn-dumb>` }) export class SmartComponent{ label = 'Click'; onDumb(event) { console.log(event); } }
Specs 22 to 29