Diskussionsthread zur Schulung #1
Replies: 33 comments
-
|
Beta Was this translation helpful? Give feedback.
-
Node Version Manager |
Beta Was this translation helpful? Give feedback.
-
Direkt die lokale CLI verwenden: |
Beta Was this translation helpful? Give feedback.
-
<div class="container">
<h1>
<img
width="100"
alt="Angular Logo"
src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADUCAMAAADukpxMAAAC5VBMVEUAAADXIcDlF4rTE57fJsHDCp/tJq3oLc+aHfOaG/DLLPHDKO7PGbTsH4mfIPbyCkyeIfrME6fdJcH2CEayIefxJZbeB3bzI3/4LqzoCV2+Ju34BED4CEP4MsPzJYX3A0T0Jo32Akf1KJr4BUH0KJ/yEFr0LLLyAU/0AUv1LretJvv5McD2L7z1Ck6qJfujI/q1Jvb0K6yxJvqfIfj4L7P0KqjzEFL2C0b1KJf1J5T0C1PzBVP0KaT1DUj1Mcv3LayuJfe5J/T1Mcb0D072Ckv3B0f4MsfyLb32Kp3KLPOZHfP0LK/0JYm4KPecIPeZG+31L8H4MLjzJICnJPvzC1f0D0vDKvTOLfLGK/TzMc/2BEryInjtAVjxBVf1BU21JfKxJfatI/S+KPHxMtenI/ejIfb4MLu9KfX3M8/zEFbwAVKVHfeeHvPyLLfzI33xC1vCKfH5Mb2VGu+kHu33LKXMB4/vBVvyLsL4Lq/3K6HcBXe0J/mqJPfHKvCwI+71M9bvAVWKGPXLK/CfHe7xMMzyL8j3LKjrAVylIfOxJPL2M9PiHaDoAWCZH/iPGvXSLvKhH/LFKe6fG+rvM9/xM9vPBoryIXTtCGPtBl/AKvW1JO7aJMXcGaGRGfGtIvCpHunxMdPcHazdF5vWBX/gA2/wCl+7JvDBJ+2qIOy4JOrmGI27KffcJMHZIbvHCJfhFpGpIvSoIfCuIOneHKbSFqb0JZDlAWT5L7XjHJz1J5G4JfD0NNrbH7TVFqLYFp3iAmn4MsvXHbTgIKzYGafeFpbSBYTpBGTuNOLUHrrfIbPXG63ECJvKB5OVHPPmGpLYBHvyIG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3QwvQpCkv87mYHgdllatWrVqpfoDd3j22Ol6d1oAAAAASUVORK5CYII="
/>
{{ title }}
</h1>
<!-- <router-outlet></router-outlet> -->
</div> |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
@if (book) {
<div class="card mb-4">
<div class="card-body bg-light">
<img class="img-thumbnail float-end" alt="" src="https://api.angular.schule/avatar/{{ book.rating }}">
<div class="card-title">
<h2>
{{ book.title }}
<span class="badge bg-secondary">{{ book.rating }}</span>
</h2>
</div>
<p>{{ book.description }}</p>
</div>
</div>
} |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
import { Book } from './book';
import { BookRatingService } from './book-rating.service';
fdescribe('BookRatingService', () => {
let service: BookRatingService;
let book: Book;
// Arrange
beforeEach(() => {
service = new BookRatingService();
book = {
isbn: '000',
title: 'Test',
description: 'Test',
rating: 3
}
});
it('should rate up a book by one', () => {
// Act
const ratedBook = service.rateUp(book);
// Assert
expect(ratedBook.rating).toBe(4);
});
it('should rate down a book by one', () => {
const ratedBook = service.rateDown(book);
expect(ratedBook.rating).toBe(2);
});
it('should not be allowed to have a rating greater than 5', () => {
book.rating = 5;
const ratedBook = service.rateUp(book);
expect(ratedBook.rating).toBe(5);
});
it('should not be allowed to have a rating smaller than 1', () => {
book.rating = 1;
const ratedBook = service.rateDown(book);
expect(ratedBook.rating).toBe(1);
});
it('should not mutate the book', () => {
const frozenBook = Object.freeze(book);
expect(() => service.rateUp(frozenBook)).not.toThrow();
expect(() => service.rateDown(frozenBook)).not.toThrow();
});
}); |
Beta Was this translation helpful? Give feedback.
-
Hands on (für Donnerstag)1.) Gesamtzahl der Bücher ausgeben Hinweis: Wir wollen natürlich nicht |
Beta Was this translation helpful? Give feedback.
-
Chrome DevTools Deep Dive |
Beta Was this translation helpful? Give feedback.
-
TypeScript: useDefineForClassFields – How to avoid future Breaking Changeshttps://angular-buch.com/blog/2022-11-use-define-for-class-fields 🇩🇪 |
Beta Was this translation helpful? Give feedback.
-
import { StarRatingPipe } from './star-rating.pipe';
describe('StarRatingPipe', () => {
let pipe: StarRatingPipe;
beforeEach(() => {
pipe = new StarRatingPipe();
});
it('should return 3 filled stars and 2 empty stars for a rating of 3', () => {
expect(pipe.transform(3)).toBe('★★★☆☆');
});
it('should return 5 filled stars for a rating of 5', () => {
expect(pipe.transform(5)).toBe('★★★★★');
});
it('should return 5 empty stars for a rating of 0', () => {
expect(pipe.transform(0)).toBe('☆☆☆☆☆');
});
}); |
Beta Was this translation helpful? Give feedback.
-
describe('My First Test', () => {
it('has the text three books', () => {
cy.visit('/')
cy.contains('Anzahl Bücher: 3')
})
it('press upvote and check for 5 stars', () => {
cy.visit('/')
cy.contains('+1').click();
cy.contains('Test ⭐ ⭐')
})
}) |
Beta Was this translation helpful? Give feedback.
-
it('should emit rateUp event when clicking the button', () => {
component.rateUpAllowed = true;
component.rateDownAllowed = true;
fixture.detectChanges();
jest.spyOn(component.rateUp, 'emit');
const button = fixture.nativeElement.querySelector('.rate-up');
button.click();
fixture.whenStable().then(() => {
expect(component.rateUp.emit).toHaveBeenCalled();
});
}); |
Beta Was this translation helpful? Give feedback.
-
TODO für Johannes: mit async/await |
Beta Was this translation helpful? Give feedback.
-
Other exclusions that may help cypress-io/cypress#22059 (comment) "exclude": [
"./cypress.config.ts",
"node_modules",
"cypress",
"**/*.cy.tsx"
] |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
<form>
<div class="form-group">
<label for="isbn">ISBN</label>
<input type="text" class="form-control" id="isbn">
@if (true) {
<div class="feedback-error">Die ISBN ist ungültig!</div>
}
</div>
<div class="form-group">
<label for="title">Titel</label>
<input type="text" class="form-control" id="title">
</div>
<div class="form-group">
<label for="description">Beschreibung</label>
<textarea class="form-control" id="description"></textarea>
</div>
<button type="submit" class="btn btn-primary mb-4">Erstellen</button>
</form> |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
🎮 NEU: RxJS PlaygroundDu kannst dir entweder
cd rxjs-playground
npm install
ng serve Öffne den Browser unter der URL http://localhost:4300 (!), um die Anwendung zu sehen. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
import { HttpClient } from '@angular/common/http';
import { inject, Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { Book } from './book';
@Injectable({
providedIn: 'root'
})
export class BookStoreService {
http = inject(HttpClient);
getBooks(): Observable<Book[]> {
return this.http.get<Book[]>('https://api.angular.schule/books');
}
getSingleBook(isbn: string): Observable<Book> {
return this.http.get<Book>('https://api.angular.schule/books/' + isbn);
}
} |
Beta Was this translation helpful? Give feedback.
-
Hands on (für Freitag)
|
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Hier können wir während des Workshops Links und Codeschnipsel teilen.
Beta Was this translation helpful? Give feedback.
All reactions