1
0
Fork 0
mirror of synced 2024-06-27 02:20:35 +12:00

Fixing internal table issues and updating createTable cypress test case.

This commit is contained in:
mike12345567 2021-06-02 12:32:07 +01:00
parent 132f084ca5
commit fa455e8eef
5 changed files with 10 additions and 9 deletions

View file

@ -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")
})

View file

@ -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(() => {

View file

@ -99,6 +99,7 @@
tables.deleteField(field)
notifications.success(`Column ${field.name} deleted.`)
confirmDeleteDialog.hide()
hide()
deletion = false
}
}

View file

@ -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) {

View file

@ -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)