Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

react: check callback values after multiple value changes #1194

Merged
merged 4 commits into from
Feb 26, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 49 additions & 2 deletions exercises/react/canonical-data.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"exercise": "react",
"version": "1.1.0",
"version": "1.2.0",
"comments": [
"Note that, due to the nature of this exercise,",
"the tests are specified using their cells and a series of operations to perform on the cells.",
Expand All @@ -17,7 +17,7 @@
"* add_callback (`cell`, `name`): Adds a callback to cell `cell`. Store the callback ID in a variable named `name`.",
" all callbacks are assumed to simply store the values they're called with in some array.",
"* remove_callback (`cell`, `name`): Removes the callback `name` from cell `cell`.",
"* expect_callback_values (`callback`, `values`): Expects callback `callback` to have been called with values `values`.",
"* expect_callback_values (`callback`, `values`): Expects callback `callback` to have been called with values `values` since the last `expect_callback_values` operation.",
"",
"Additional notes:",
"",
Expand Down Expand Up @@ -314,6 +314,53 @@
},
"expected": {}
},
{
"description": "callbacks do not report already reported values",
"property": "react",
"input": {
"cells": [
{
"name": "input",
"type": "input",
"initial_value": 1
},
{
"name": "output",
"type": "compute",
"inputs": ["input"],
"compute_function": "inputs[0] + 1"
}
],
"operations": [
{
"type": "add_callback",
"cell": "output",
"name": "callback1"
},
{
"type": "set_value",
"cell": "input",
"value": 2
},
{
"type": "expect_callback_values",
"callback": "callback1",
"values": [3]
},
{
"type": "set_value",
"cell": "input",
"value": 3
},
{
"type": "expect_callback_values",
"callback": "callback1",
"values": [4]
}
]
},
"expected": {}
},
{
"description": "callbacks can be added and removed",
"property": "react",
Expand Down