Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions cypress/e2e/ToDo list.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"numberSuffix": "",
"textDefault": "",
"textAllowedPattern": "",
"textMaxLength": -1,
"textMaxLength": null,
"textUnique": false,
"selectionOptions": [],
"selectionDefault": "",
Expand Down Expand Up @@ -61,7 +61,7 @@
"numberSuffix": "",
"textDefault": "",
"textAllowedPattern": "",
"textMaxLength": -1,
"textMaxLength": null,
"textUnique": false,
"selectionOptions": [],
"selectionDefault": "",
Expand Down Expand Up @@ -99,7 +99,7 @@
"numberSuffix": "",
"textDefault": "",
"textAllowedPattern": "",
"textMaxLength": -1,
"textMaxLength": null,
"textUnique": false,
"selectionOptions": [],
"selectionDefault": "",
Expand Down Expand Up @@ -135,7 +135,7 @@
"numberSuffix": "",
"textDefault": "",
"textAllowedPattern": "",
"textMaxLength": -1,
"textMaxLength": null,
"textUnique": false,
"selectionOptions": [],
"selectionDefault": "",
Expand Down Expand Up @@ -171,7 +171,7 @@
"numberSuffix": "",
"textDefault": "",
"textAllowedPattern": "",
"textMaxLength": -1,
"textMaxLength": null,
"textUnique": false,
"selectionOptions": [],
"selectionDefault": "",
Expand Down Expand Up @@ -207,7 +207,7 @@
"numberSuffix": "",
"textDefault": "",
"textAllowedPattern": "",
"textMaxLength": -1,
"textMaxLength": null,
"textUnique": false,
"selectionOptions": [],
"selectionDefault": "",
Expand Down
18 changes: 15 additions & 3 deletions cypress/e2e/tables-rows.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,35 @@ describe('Rows for a table', () => {

it('Edit', () => {
cy.loadTable('Welcome to Nextcloud Tables!')
cy.get('[data-cy="ncTable"] [data-cy="customTableRow"]').contains('My first task').closest('[data-cy="customTableRow"]').find('[data-cy="editRowBtn"]').click()
cy.get('[data-cy="createRowBtn"]').click({ force: true })
cy.get('[data-cy="createRowModal"] .slot input').first().type('Row to edit')
cy.get('[data-cy="createRowSaveButton"]').click()
cy.get('[data-cy="createRowModal"]').should('not.exist')

cy.get('[data-cy="ncTable"] [data-cy="customTableRow"]').contains('Row to edit').closest('[data-cy="customTableRow"]').find('[data-cy="editRowBtn"]').click()
cy.get('[data-cy="editRowModal"] .slot input').first().clear().type('Changed column value')
cy.get('[data-cy="editRowModal"] [aria-label="Increase stars"]').click().click()
cy.get('[data-cy="editRowSaveButton"]').click()

cy.get('[data-cy="editRowModal"]').should('not.exist')
cy.get('.icon-loading-small').should('not.exist')
cy.get('[data-cy="ncTable"] table').contains('Changed column value').should('exist')
})

it('Delete', () => {
cy.loadTable('Welcome to Nextcloud Tables!')
cy.get('[data-cy="ncTable"] [data-cy="customTableRow"]').contains('Changed column value').closest('[data-cy="customTableRow"]').find('[data-cy="editRowBtn"]').click()
cy.get('[data-cy="createRowBtn"]').click({ force: true })
cy.get('[data-cy="createRowModal"] .slot input').first().type('Row to delete')
cy.get('[data-cy="createRowSaveButton"]').click()
cy.get('[data-cy="createRowModal"]').should('not.exist')

cy.get('[data-cy="ncTable"] [data-cy="customTableRow"]').contains('Row to delete').closest('[data-cy="customTableRow"]').find('[data-cy="editRowBtn"]').click()
cy.get('[data-cy="editRowDeleteButton"]').click()
cy.get('[data-cy="editRowDeleteConfirmButton"]').click()

cy.get('[data-cy="editRowModal"]').should('not.exist')
cy.get('[data-cy="ncTable"] table').contains('Changed column value').should('not.exist')
cy.get('.icon-loading-small').should('not.exist')
cy.get('[data-cy="ncTable"] table').contains('Row to delete').should('not.exist')
})

it('Check mandatory fields error', () => {
Expand Down
18 changes: 9 additions & 9 deletions cypress/fixtures/widgets/richObject.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"numberSuffix": "",
"textDefault": "",
"textAllowedPattern": "",
"textMaxLength": -1,
"textMaxLength": null,
"textUnique": false,
"selectionOptions": [],
"selectionDefault": "",
Expand Down Expand Up @@ -60,7 +60,7 @@
"numberSuffix": "",
"textDefault": "",
"textAllowedPattern": "",
"textMaxLength": -1,
"textMaxLength": null,
"textUnique": false,
"selectionOptions": [],
"selectionDefault": "",
Expand Down Expand Up @@ -88,7 +88,7 @@
"numberSuffix": "",
"textDefault": "",
"textAllowedPattern": "",
"textMaxLength": -1,
"textMaxLength": null,
"textUnique": false,
"selectionOptions": [],
"selectionDefault": "",
Expand Down Expand Up @@ -116,7 +116,7 @@
"numberSuffix": "",
"textDefault": "",
"textAllowedPattern": "",
"textMaxLength": -1,
"textMaxLength": null,
"textUnique": false,
"selectionOptions": [],
"selectionDefault": "",
Expand Down Expand Up @@ -144,7 +144,7 @@
"numberSuffix": "",
"textDefault": "",
"textAllowedPattern": "",
"textMaxLength": -1,
"textMaxLength": null,
"textUnique": false,
"selectionOptions": [],
"selectionDefault": "",
Expand Down Expand Up @@ -172,7 +172,7 @@
"numberSuffix": "",
"textDefault": "",
"textAllowedPattern": "",
"textMaxLength": -1,
"textMaxLength": null,
"textUnique": false,
"selectionOptions": [],
"selectionDefault": "",
Expand Down Expand Up @@ -200,7 +200,7 @@
"numberSuffix": "",
"textDefault": "",
"textAllowedPattern": "",
"textMaxLength": -1,
"textMaxLength": null,
"textUnique": false,
"selectionOptions": [],
"selectionDefault": "",
Expand Down Expand Up @@ -228,7 +228,7 @@
"numberSuffix": "",
"textDefault": "",
"textAllowedPattern": "",
"textMaxLength": -1,
"textMaxLength": null,
"textUnique": false,
"selectionOptions": [],
"selectionDefault": "",
Expand Down Expand Up @@ -256,7 +256,7 @@
"numberSuffix": "",
"textDefault": "",
"textAllowedPattern": "",
"textMaxLength": -1,
"textMaxLength": null,
"textUnique": false,
"selectionOptions": [],
"selectionDefault": "",
Expand Down
14 changes: 10 additions & 4 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,12 @@ Cypress.Commands.add('createView', (title) => {
})

Cypress.Commands.add('openCreateColumnModal', (isFirstColumn) => {
cy.get('.icon-loading').should('not.exist')
if (isFirstColumn) {
cy.get('.button-vue__text').contains('Create column').click({ force: true })
cy.get('[data-cy="emptyTableCreateColumnBtn"]').should('be.visible').click({ force: true })
} else {
cy.get('[data-cy="customTableAction"] button').click()
cy.get('[data-cy="dataTableCreateColumnBtn"]').contains('Create column').click({ force: true })
cy.get('[data-cy="dataTableCreateColumnBtn"]').should('be.visible').click({ force: true })
}
})

Expand Down Expand Up @@ -496,8 +497,13 @@ Cypress.Commands.add('addUserToGroup', (userId, groupId) => {
})

Cypress.Commands.add('removeColumn', (title) => {
cy.get('.custom-table table tr th .cell').contains(title).click()
cy.get('[data-cy="deleteColumnActionBtn"] button').click()
cy.contains('.custom-table table tr th .cell', title)
.parents('th')
.first()
.find('.menu button')
.first()
.click({ force: true })
cy.get('[data-cy="deleteColumnActionBtn"]').should('be.visible').click({ force: true })
cy.get('[data-cy="confirmDialog"] button').contains('Confirm').click()
})

Expand Down
4 changes: 3 additions & 1 deletion lib/Controller/ApiTablesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,9 @@ public function createFromScheme(string $title, string $emoji, string $descripti
description: $column['description'],
textDefault: $column['textDefault'],
textAllowedPattern: $column['textAllowedPattern'],
textMaxLength: $column['textMaxLength'],
textMaxLength: isset($column['textMaxLength']) && $column['textMaxLength'] !== null && (int)$column['textMaxLength'] >= 0
? (int)$column['textMaxLength']
: null,
textUnique: $column['textUnique'],
numberDefault: $column['numberDefault'],
numberMin: $column['numberMin'],
Expand Down
2 changes: 1 addition & 1 deletion src/modules/main/sections/EmptyTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{{ table.emoji }}
</template>
<template v-if="canManageTable(table)" #action>
<NcButton :aria-label="t('table', 'Create column')" type="primary" @click="createColumn()">
<NcButton data-cy="emptyTableCreateColumnBtn" :aria-label="t('table', 'Create column')" type="primary" @click="createColumn()">
{{ t('tables', 'Create column') }}
</NcButton>
</template>
Expand Down
Loading