Skip to content

Commit 254c306

Browse files
committed
Merge pull request #1257 from DerekCuevas/master
Examples: todomvc: Removed precondition to clear completed todo's
2 parents c6cd6d8 + 8450792 commit 254c306

File tree

2 files changed

+1
-19
lines changed

2 files changed

+1
-19
lines changed

examples/todomvc/components/MainSection.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@ class MainSection extends Component {
1616
}
1717

1818
handleClearCompleted() {
19-
const atLeastOneCompleted = this.props.todos.some(todo => todo.completed)
20-
if (atLeastOneCompleted) {
21-
this.props.actions.clearCompleted()
22-
}
19+
this.props.actions.clearCompleted()
2320
}
2421

2522
handleShow(filter) {

examples/todomvc/test/components/MainSection.spec.js

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -102,21 +102,6 @@ describe('components', () => {
102102
footer.props.onClearCompleted()
103103
expect(props.actions.clearCompleted).toHaveBeenCalled()
104104
})
105-
106-
it('onClearCompleted shouldnt call clearCompleted if no todos completed', () => {
107-
const { output, props } = setup({
108-
todos: [
109-
{
110-
text: 'Use Redux',
111-
completed: false,
112-
id: 0
113-
}
114-
]
115-
})
116-
const [ , , footer ] = output.props.children
117-
footer.props.onClearCompleted()
118-
expect(props.actions.clearCompleted.calls.length).toBe(0)
119-
})
120105
})
121106

122107
describe('todo list', () => {

0 commit comments

Comments
 (0)