Skip to content

Instantly share code, notes, and snippets.

Christian Lüdemann lydemann

Block or report user

Report or block lydemann

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View todo.po.ts
export class TodoPage {
public static interceptTodoListRequest(todoList: any[]) {
cy.server();
cy.route('http://localhost:8080/api/todo-list', todoList);
}
public static goToPage() {
cy.visit('/');
}
View todo.spec.ts
import { TodoPage } from '../support/todo.po';
const todoList = [
{
id: 'task1',
title: 'Do1',
description: 'Remember to buy milk',
},
{
id: 'task2',
View todo.spec.ts
import { TodoPage } from '../support/todo.po';
const todoList = [
{
id: 'task1',
title: 'Do1',
description: 'Remember to buy milk'
},
{
id: 'task2',
View todo.po.ts
export class TodoPage {
public static checkForTodos(todoList: any[]) {
todoList.forEach((todo) => {
cy.contains(todo.title);
});
}
}
View rxjs-scheduler-demo-results.ts
queue
after subscription
asap
animationFrameScheduler
async
@lydemann
lydemann / rxjs-scheduler-demo.ts
Created Jun 18, 2019
Demo of the different RxJs schedulers
View rxjs-scheduler-demo.ts
import { of, merge, asapScheduler, asyncScheduler, animationFrameScheduler, queueScheduler } from 'rxjs';
import { filter, startWith, observeOn } from 'rxjs/operators';
const delay = 0;
const async$ = of('async')
.pipe(observeOn(asyncScheduler, delay)); // macro queue
const asap$ = of('asap')
.pipe(observeOn(asapScheduler, delay)); // micro queue
@lydemann
lydemann / todo-list-sandbox.service.spec.ts
Last active Jun 18, 2019
todo-list-sandbox.service.spec.ts
View todo-list-sandbox.service.spec.ts
describe('saveTodoItem', () => {
it('should create todo', () => {
const todoItem = new TODOItem('', '');
todoListResourcesServiceStub.addTodo.and.returnValue(of(todoItem));
service
.saveTodoItem(todoItem)
.pipe(first())
.subscribe(() => {});
View todo-list.component.ts
public duedateTodayCount$ = this.todoList$.pipe(
map((todoList) => todoList.filter((todoItem) => this.isToday(todoItem.dueDate)).length)
);
private isToday(someDate) {
const today = new Date();
return (
someDate.getDate() === today.getDate() &&
someDate.getMonth() === today.getMonth() &&
someDate.getFullYear() === today.getFullYear()
@lydemann
lydemann / todo-list.component.html
Created May 31, 2019
todo-list.component.html
View todo-list.component.html
{{'todo-list-section.todos-duedate-today' | translate}}: {{duedateTodayCount$ | async}}
@lydemann
lydemann / angular.json
Created May 28, 2019
OnPush schematics
View angular.json
"projects": {
"my-project": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "app",
"schematics": {
"@schematics/angular:component": {
"changeDetection": "OnPush"
}
You can’t perform that action at this time.