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