moving test from server

This commit is contained in:
Martin McKeaveney 2020-02-12 15:47:35 +00:00
parent 695781c149
commit 78b04ea58e
2 changed files with 2 additions and 34 deletions

View File

@ -467,11 +467,11 @@ const _saveScreen = async (store, s, screen) => {
await api
.post(`/_builder/api/${s.appname}/pages/${s.currentPageName}/screen`, screen)
.then(async savedScreen => {
_savePage(s);
const updatedScreen = await savedScreen.json();
const screens = [...currentPageScreens.filter(storeScreen => storeScreen.name !== updatedScreen.name), updatedScreen];
s.pages[s.currentPageName]._screens = screens
s.screens = screens
_savePage(s);
});
return s

View File

@ -217,36 +217,4 @@ it("/savePage should prepare all necessary client files", async () => {
)
expect(savedScreen2Css).toEqual(screen2Css)
expect(indexHtmlMain.includes(screen2CssPaths.url)).toBe(true)
})
it("builds the correct stateOrigins object from a screen definition with no handlers", () => {
expect(listScreens.buildStateOrigins(screen1)).toEqual({});
});
it("builds the correct stateOrigins object from a screen definition with handlers", () => {
expect(listScreens.buildStateOrigins({
"name": "screen1",
"description": "",
"props": {
"_component": "@budibase/standard-components/div",
"className": "",
"onClick": [
{
"##eventHandlerType": "Set State",
"parameters": {
"path": "testKey",
"value": "value"
}
}
]
}
})).toEqual({
"testKey": {
"##eventHandlerType": "Set State",
"parameters": {
"path": "testKey",
"value": "value"
}
}
});
});
})