Fixing internal table issues and updating createTable cypress test case.
This commit is contained in:
parent
1da4b31890
commit
781bd7bab6
|
@ -61,10 +61,10 @@ context("Create a Table", () => {
|
|||
})
|
||||
|
||||
it("deletes a table", () => {
|
||||
cy.get(".ri-more-line")
|
||||
cy.get(".actions > :nth-child(1) > .icon > .spectrum-Icon > use")
|
||||
.first()
|
||||
.click({ force: true })
|
||||
cy.get("[data-cy=delete-table]").click()
|
||||
cy.get(".spectrum-Menu > :nth-child(2)").click()
|
||||
cy.contains("Delete Table").click()
|
||||
cy.contains("dog").should("not.exist")
|
||||
})
|
||||
|
|
|
@ -9,10 +9,7 @@ export function checkIfElementExists(el) {
|
|||
return new Promise(resolve => {
|
||||
/// here if ele exists or not
|
||||
cy.get("body").then(body => {
|
||||
const found = body.find(el)
|
||||
console.log(found)
|
||||
console.log(found.length)
|
||||
if (found.length > 0) {
|
||||
if (body.find(el).length > 0) {
|
||||
resolve(true)
|
||||
} else {
|
||||
resolve(false)
|
||||
|
@ -51,7 +48,6 @@ Cypress.Commands.add("createApp", name => {
|
|||
cy.visit(`localhost:${Cypress.env("PORT")}/builder`)
|
||||
cy.wait(500)
|
||||
isFirstApp().then(isFirst => {
|
||||
console.log(isFirst)
|
||||
const buttonText = isFirst ? "Create app" : "Create new app"
|
||||
cy.contains(buttonText).click()
|
||||
cy.get("body").then(() => {
|
||||
|
|
|
@ -99,6 +99,7 @@
|
|||
tables.deleteField(field)
|
||||
notifications.success(`Column ${field.name} deleted.`)
|
||||
confirmDeleteDialog.hide()
|
||||
hide()
|
||||
deletion = false
|
||||
}
|
||||
}
|
||||
|
|
|
@ -101,6 +101,12 @@ export function createTablesStore() {
|
|||
// Optionally set display column
|
||||
if (primaryDisplay) {
|
||||
state.draft.primaryDisplay = field.name
|
||||
} else if (state.draft.primaryDisplay === originalName) {
|
||||
const fields = Object.keys(state.draft.schema)
|
||||
// pick another display column randomly if unselecting
|
||||
state.draft.primaryDisplay = fields.filter(
|
||||
name => name !== originalName || name !== field
|
||||
)[0]
|
||||
}
|
||||
|
||||
if (indexes) {
|
||||
|
|
|
@ -75,8 +75,6 @@ exports.save = async function (ctx) {
|
|||
/* istanbul ignore next */
|
||||
if (_rename && tableToSave.schema[_rename.updated].type === FieldTypes.LINK) {
|
||||
ctx.throw(400, "Cannot rename a linked column.")
|
||||
} else if (_rename && tableToSave.primaryDisplay === _rename.old) {
|
||||
ctx.throw(400, "Cannot rename the display column.")
|
||||
}
|
||||
|
||||
tableToSave = await tableSaveFunctions.mid(tableToSave)
|
||||
|
|
Loading…
Reference in New Issue