Skip to content

Commit

Permalink
test(ivy): fixes in the TodoMVC example (#23161)
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
pkozlowski-opensource authored and alxhub committed Apr 4, 2018
1 parent f99cb5c commit 32a41bc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/core/test/bundling/todo/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class AppState {
// but NgForOf expects creation and binding separate.
template: `
<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;
<button (click)="onArchiveClick()">archive</button>
</div>
Expand Down Expand Up @@ -71,7 +71,7 @@ export class ToDoAppComponent {

onArchive(item: ToDo) {
const todos = this.appState.todos;
todos.splice(todos.indexOf(item));
todos.splice(todos.indexOf(item), 1);
markDirty(this);

This comment has been minimized.

Copy link
@alexzuza

alexzuza Apr 4, 2018

Contributor

Can we omit markDirty here since it will be automatically marked as dirty once event is fired

export function wrapListenerWithDirtyAndDefault(
view: LView, listenerFn: (e?: any) => any): EventListener {
return function(e: Event) {
markViewDirty(view);

}
}
Expand Down Expand Up @@ -108,4 +108,4 @@ export class ToDoAppModule {
renderComponent(ToDoAppComponent, {
// TODO(misko): This should run without injector.
injector: createInjector(ToDoAppModule)
});
});

0 comments on commit 32a41bc

Please sign in to comment.