Code review updates

This commit is contained in:
Dean 2022-05-16 11:13:17 +01:00
parent 6f7cf9dac8
commit 883765f894
3 changed files with 32 additions and 9 deletions

View File

@ -123,6 +123,17 @@ filterTests(['smoke', 'all'], () => {
cy.applicationInAppTable("Teds app")
cy.deleteApp("Teds app")
//Accomodate names that end in 'S'
cy.updateUserInformation("Chris", "Userman")
cy.createApp()
cy.visit(`${Cypress.config().baseUrl}/builder`)
cy.wait(1000)
cy.applicationInAppTable("Chris app")
cy.deleteApp("Chris app")
cy.updateUserInformation("", "")
})

View File

@ -79,8 +79,9 @@ Cypress.Commands.add("updateUserInformation", (firstName, lastName) => {
})
cy.get(".spectrum-Modal.is-open").within(() => {
cy.get("[data-cy='user-first-name']").clear()
if (!firstName || firstName == "") {
cy.get("[data-cy='user-first-name']").clear()
cy.get("[data-cy='user-first-name']").invoke("val").should("be.empty")
} else {
cy.get("[data-cy='user-first-name']")
@ -88,8 +89,10 @@ Cypress.Commands.add("updateUserInformation", (firstName, lastName) => {
.should("have.value", firstName)
.blur()
}
cy.get("[data-cy='user-last-name']").clear()
if (!lastName || lastName == "") {
cy.get("[data-cy='user-last-name']").clear()
cy.get("[data-cy='user-last-name']").invoke("val").should("be.empty")
} else {
cy.get("[data-cy='user-last-name']")

View File

@ -16,16 +16,27 @@
export let template
let creating = false
let defaultAppName
const values = writable({ name: "", url: null })
const validation = createValidationStore()
$: validation.check($values)
onMount(async () => {
const defaultName = $auth.user?.firstName
? `${$auth.user.firstName}s app`
: "My app"
$values.name = resolveAppName(template, defaultName)
const lastChar = $auth.user?.firstName
? $auth.user?.firstName[$auth.user?.firstName.length - 1]
: null
console.log(lastChar)
defaultAppName =
lastChar && lastChar.toLowerCase() == "s"
? `${$auth.user?.firstName} app`
: `${$auth.user.firstName}s app`
console.log(defaultAppName)
$values.name = resolveAppName(
template,
!$auth.user?.firstName ? "My app" : defaultAppName
)
nameToUrl($values.name)
await setupValidation()
})
@ -169,9 +180,7 @@
on:blur={() => ($validation.touched.name = true)}
on:change={nameToUrl($values.name)}
label="Name"
placeholder={$auth.user?.firstName
? `${$auth.user.firstName}s app`
: "My app"}
placeholder={defaultAppName}
/>
<span>
<Input