2020-02-12 16:10:27 +01:00
|
|
|
import { buildStateOrigins } from "../src/builderStore/buildStateOrigins";
|
|
|
|
|
|
|
|
it("builds the correct stateOrigins object from a screen definition with handlers", () => {
|
|
|
|
expect(buildStateOrigins({
|
|
|
|
"name": "screen1",
|
|
|
|
"description": "",
|
|
|
|
"props": {
|
2020-02-14 12:51:45 +01:00
|
|
|
"_component": "@budibase/standard-components/container",
|
2020-02-12 16:10:27 +01:00
|
|
|
"className": "",
|
2020-02-14 12:51:45 +01:00
|
|
|
"type": "div",
|
2020-02-12 16:10:27 +01:00
|
|
|
"onClick": [
|
|
|
|
{
|
|
|
|
"##eventHandlerType": "Set State",
|
|
|
|
"parameters": {
|
|
|
|
"path": "testKey",
|
|
|
|
"value": "value"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
})).toEqual({
|
|
|
|
"testKey": {
|
|
|
|
"##eventHandlerType": "Set State",
|
|
|
|
"parameters": {
|
|
|
|
"path": "testKey",
|
|
|
|
"value": "value"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|