replace spaces with underscores in screen routes
This commit is contained in:
parent
775bcc631c
commit
519d2bd0fb
|
@ -7,5 +7,15 @@ context("Screen Tests", () => {
|
||||||
|
|
||||||
it("Should successfully create a screen", () => {
|
it("Should successfully create a screen", () => {
|
||||||
cy.createScreen("Test Screen", "/test")
|
cy.createScreen("Test Screen", "/test")
|
||||||
|
cy.get(".nav-items-container").within(() => {
|
||||||
|
cy.contains("/test").should("exist")
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
it("Should update the url", () => {
|
||||||
|
cy.createScreen("Test Screen", "test with spaces")
|
||||||
|
cy.get(".nav-items-container").within(() => {
|
||||||
|
cy.contains("/test_with_spaces").should("exist")
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -160,7 +160,5 @@ Cypress.Commands.add("createScreen", (screenName, route) => {
|
||||||
cy.get("input").eq(1).type(route)
|
cy.get("input").eq(1).type(route)
|
||||||
cy.get(".spectrum-Button--cta").click()
|
cy.get(".spectrum-Button--cta").click()
|
||||||
})
|
})
|
||||||
cy.get(".nav-items-container").within(() => {
|
|
||||||
cy.contains(route).should("exist")
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
|
@ -84,6 +84,7 @@
|
||||||
if (!event.detail.startsWith("/")) {
|
if (!event.detail.startsWith("/")) {
|
||||||
route = "/" + event.detail
|
route = "/" + event.detail
|
||||||
}
|
}
|
||||||
|
route = route.replaceAll(' ', '_')
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
} from "builderStore/dataBinding"
|
} from "builderStore/dataBinding"
|
||||||
import BindingPanel from "components/common/bindings/BindingPanel.svelte"
|
import BindingPanel from "components/common/bindings/BindingPanel.svelte"
|
||||||
import { capitalise } from "helpers"
|
import { capitalise } from "helpers"
|
||||||
|
import { createEventDispatcher } from "svelte"
|
||||||
|
|
||||||
export let label = ""
|
export let label = ""
|
||||||
export let bindable = true
|
export let bindable = true
|
||||||
|
@ -17,11 +18,12 @@
|
||||||
export let type = ""
|
export let type = ""
|
||||||
export let value = null
|
export let value = null
|
||||||
export let props = {}
|
export let props = {}
|
||||||
export let onChange = () => {}
|
|
||||||
|
|
||||||
let bindingDrawer
|
let bindingDrawer
|
||||||
let anchor
|
let anchor
|
||||||
let valid
|
let valid
|
||||||
|
let dispatch = createEventDispatcher();
|
||||||
|
|
||||||
|
|
||||||
$: bindableProperties = getBindableProperties(
|
$: bindableProperties = getBindableProperties(
|
||||||
$currentAsset,
|
$currentAsset,
|
||||||
|
@ -53,9 +55,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof innerVal === "string") {
|
if (typeof innerVal === "string") {
|
||||||
onChange(replaceBindings(innerVal))
|
dispatch('change', replaceBindings(innerVal))
|
||||||
} else {
|
} else {
|
||||||
onChange(innerVal)
|
dispatch('change', innerVal)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,11 @@
|
||||||
|
|
||||||
export let componentInstance
|
export let componentInstance
|
||||||
|
|
||||||
function setAssetProps(name, value) {
|
function setAssetProps(name, value, parser) {
|
||||||
|
if (parser && typeof parser === 'function') {
|
||||||
|
value = parser(value)
|
||||||
|
}
|
||||||
|
|
||||||
const selectedAsset = get(currentAsset)
|
const selectedAsset = get(currentAsset)
|
||||||
store.update(state => {
|
store.update(state => {
|
||||||
if (
|
if (
|
||||||
|
@ -28,7 +32,7 @@
|
||||||
|
|
||||||
const screenSettings = [
|
const screenSettings = [
|
||||||
// { key: "description", label: "Description", control: Input },
|
// { key: "description", label: "Description", control: Input },
|
||||||
{ key: "routing.route", label: "Route", control: Input },
|
{ key: "routing.route", label: "Route", control: Input, parser: (val) => val.replaceAll(' ', '_') },
|
||||||
{ key: "routing.roleId", label: "Access", control: RoleSelect },
|
{ key: "routing.roleId", label: "Access", control: RoleSelect },
|
||||||
{ key: "layoutId", label: "Layout", control: LayoutSelect },
|
{ key: "layoutId", label: "Layout", control: LayoutSelect },
|
||||||
]
|
]
|
||||||
|
@ -43,7 +47,7 @@
|
||||||
label={def.label}
|
label={def.label}
|
||||||
key={def.key}
|
key={def.key}
|
||||||
value={deepGet($currentAsset, def.key)}
|
value={deepGet($currentAsset, def.key)}
|
||||||
onChange={val => setAssetProps(def.key, val)}
|
on:change={event => setAssetProps(def.key, event.detail, def.parser)}
|
||||||
/>
|
/>
|
||||||
{/each}
|
{/each}
|
||||||
</DetailSummary>
|
</DetailSummary>
|
||||||
|
|
Loading…
Reference in New Issue