This commit is contained in:
Martin McKeaveney 2020-11-20 11:41:17 +00:00
parent e369cbc6b3
commit 42d8a94f9a
5 changed files with 7 additions and 14 deletions

View File

@ -7,17 +7,7 @@ context('Screen Tests', () => {
cy.navigateToFrontend() cy.navigateToFrontend()
}) })
it('Should successful create a screen', () => { it('Should successfully create a screen', () => {
cy.createScreen("test Screen", "/test") cy.createScreen("test Screen", "/test")
}) })
it('Should rename a screen', () => {
cy.get(".components-pane").within(() => {
cy.contains("Settings").click()
cy.get("input[name=_instanceName]").clear().type("About Us").blur()
})
cy.get('.nav-items-container').within(() => {
cy.contains("About Us").should('exist')
})
})
}) })

View File

@ -166,6 +166,6 @@ Cypress.Commands.add("createScreen", (screenName, route) => {
cy.contains("Create Screen").click() cy.contains("Create Screen").click()
}) })
cy.get(".nav-items-container").within(() => { cy.get(".nav-items-container").within(() => {
cy.contains(screenName).should("exist") cy.contains(route).should("exist")
}) })
}) })

View File

@ -36,7 +36,7 @@
indentLevel={indent || 1} indentLevel={indent || 1}
selected={$store.currentPreviewItem._id === screenId} selected={$store.currentPreviewItem._id === screenId}
opened={$store.currentPreviewItem._id === screenId} opened={$store.currentPreviewItem._id === screenId}
text={url === "/" ? "Home" : url} text={url === '/' ? 'Home' : url}
withArrow={route.subpaths} withArrow={route.subpaths}
on:click={() => changeScreen(screenId)}> on:click={() => changeScreen(screenId)}>
<ScreenDropdownMenu screen={screenId} /> <ScreenDropdownMenu screen={screenId} />

View File

@ -76,6 +76,7 @@
if (createLink) { if (createLink) {
await store.actions.components.links.save(route, name) await store.actions.components.links.save(route, name)
} }
await store.actions.routing.fetch()
if (templateIndex !== undefined) { if (templateIndex !== undefined) {
const template = templates[templateIndex] const template = templates[templateIndex]

View File

@ -43,7 +43,9 @@ export const screenRouter = ({ screens, onScreenSelected, window }) => {
return sanitize(url) return sanitize(url)
} }
const routes = screens.map(screen => makeRootedPath(screen?.routing.route)) const routes = screens.map(screen =>
makeRootedPath(screen.routing ? screen.routing.route : null)
)
let fallback = routes.findIndex(([p]) => p === makeRootedPath("*")) let fallback = routes.findIndex(([p]) => p === makeRootedPath("*"))
if (fallback < 0) fallback = 0 if (fallback < 0) fallback = 0