Skip to content

Instantly share code, notes, and snippets.

View artberri's full-sized avatar
👋
Hello world!

Alberto Varela artberri

👋
Hello world!
View GitHub Profile
import { Todo } from '../entities';
export abstract class TodoStorageService {
public abstract getTodos(): Todo[];
public abstract saveTodos(todos: Todo[]): void;
}
import { Service, BasePresenter, Mediator } from '../framework';
import { AppState, LoadTodosCommand, SaveTodosCommand, GetAllTodosQuery, ContainsAnyTodosQuery } from '../model';
import { IAppView } from '../views';
@Service()
export class AppPresenter extends BasePresenter<IAppView> {
constructor(
private readonly mediator: Mediator,
private readonly state: AppState
) {
// ...
describe('On toggle checkbox clicked', () => {
describe('when it is initially active', () => {
beforeEach(() => {
view.todo = activeTodo;
presenter.attach(view);
jest.clearAllMocks();
});
test('completes the todo', () => {
import { Component, Input, HostBinding, OnInit } from '@angular/core';
import { Todo, TodoMixin, ITodoView, TodoPresenter, Injector } from '../../../../../app/src';
import { BaseView } from 'src/app/base.view';
@Component({
selector: '[app-todo]',
templateUrl: 'todo.template.html',
styles: []
})
export class TodoComponent extends TodoMixin(BaseView) implements ITodoView, OnInit {
<div class="view">
<input class="toggle"
type="checkbox"
[checked]="isCompleted"
(click)="onToggleCheckboxClicked()">
<label (dblclick)="onDoubleClicked()">{{ todo.title }}</label>
<button class="destroy" (click)="onRemoveButtonClicked()"></button>
</div>
<input [(ngModel)]="todoTitleInput"
class="edit"
<script lang="ts">
import { Component, Vue, Prop } from 'vue-property-decorator';
import { Todo, ITodoView } from '../../../app/src';
@Component
export class VueTodoMixin extends TodoMixin(Vue) {}
@Component({
mixins: [VueTodoMixin]
})