test(ivy): fixes in the TodoMVC example (#23161)

- properly display initial checked state
- properly remove a todo

Please note that the 'archive' option still doesn't
work correctly as listening to component outputs doesn't
seem to work (onArchive() is never called).

PR Close #23161
This commit is contained in:
Pawel Kozlowski 2018-04-04 14:39:07 +02:00 committed by Alex Rickabaugh
parent f99cb5c995
commit 32a41bc738
1 changed files with 3 additions and 3 deletions

View File

@ -33,7 +33,7 @@ export class AppState {
// but NgForOf expects creation and binding separate. // but NgForOf expects creation and binding separate.
template: ` template: `
<div> <div>
<input type="checkbox" [value]="todo && todo.done" (click)="onCheckboxClick()">&ngsp; <input type="checkbox" [checked]="todo && todo.done" (change)="onCheckboxClick()">&ngsp;
<span [class.done]="todo && todo.done">{{todo && todo.text}}</span>&ngsp; <span [class.done]="todo && todo.done">{{todo && todo.text}}</span>&ngsp;
<button (click)="onArchiveClick()">archive</button> <button (click)="onArchiveClick()">archive</button>
</div> </div>
@ -71,7 +71,7 @@ export class ToDoAppComponent {
onArchive(item: ToDo) { onArchive(item: ToDo) {
const todos = this.appState.todos; const todos = this.appState.todos;
todos.splice(todos.indexOf(item)); todos.splice(todos.indexOf(item), 1);
markDirty(this); markDirty(this);
} }
} }
@ -108,4 +108,4 @@ export class ToDoAppModule {
renderComponent(ToDoAppComponent, { renderComponent(ToDoAppComponent, {
// TODO(misko): This should run without injector. // TODO(misko): This should run without injector.
injector: createInjector(ToDoAppModule) injector: createInjector(ToDoAppModule)
}); });