Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
TDD Angular Workshop
Search
Pablo Villoslada Puigcerber
May 15, 2018
Programming
120
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
TDD Angular Workshop
Pablo Villoslada Puigcerber
May 15, 2018
More Decks by Pablo Villoslada Puigcerber
See All by Pablo Villoslada Puigcerber
Angular on Fire!
puigcerber
0
81
Introducción a Angular 2
puigcerber
0
75
Introduction to AngularJS
puigcerber
0
66
AngularJS en una hora
puigcerber
0
110
Other Decks in Programming
See All in Programming
[2026-09-26]空論ジェネリックプロセス~テスト資産とAIで紡ぐ、再現可能なパフォーマンスチューニングの話~
tosite
0
270
FactoryBotをやめればRSpecは速くなるのか?
yuta_onishi_97
0
290
Domain-Driven Transformation
hschwentner
2
2.3k
ジョジョの世界をXRで再現する
mofurune
0
160
機械に任せるテスト、人が見るテスト ⽣成AIで引き直した、運⽤保守フェーズの線引き
dske104
0
190
Everything will be SERVERLESS — 信じて運用した10年の経験値 / Everything Will be Serverless — Lessons Learned from 10 Years of Operational Experience
seike460
PRO
1
1.1k
SalesForceを内製化!? ~ HR事業を支える顧客管理基盤のインフラを大公開 ~
oku053
0
180
月間100万人のサービス刷新で、 技術選定をHonoに振り切った話
yutobara
8
6.6k
自サークルのIdPからログアウトできるようになるまで
taiseiue
1
140
RAG の “R” を Swift で覗いてみる 〜「意味から探す」検索の仕組み〜
nao_randd
0
160
Railsのためのパスキー実践入門 〜マルチテナントSaaSでの意思決定〜
utakaha
2
550
Agentic Software Factoryに、すごく賢いIF文を。 / super smart IF statement into the Agentic Software Factory.
rkaga
8
2.2k
Featured
See All Featured
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.6k
Product Roadmaps are Hard
iamctodd
55
13k
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
3.2k
Large-scale JavaScript Application Architecture
addyosmani
516
110k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
400
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
Accessibility Awareness
sabderemane
1
250
Thoughts on Productivity
jonyablonski
76
5.4k
Ethics towards AI in product and experience design
skipperchong
2
430
Joys of Absence: A Defence of Solitary Play
codingconduct
1
550
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