diff --git a/src/components/renderer/file-upload.vue b/src/components/renderer/file-upload.vue index ceeb00bb7..b76c9004e 100644 --- a/src/components/renderer/file-upload.vue +++ b/src/components/renderer/file-upload.vue @@ -597,6 +597,10 @@ export default { } if (displayMessage.length > 0) { + const data = JSON.parse(displayMessage); + if (data.message) { + displayMessage = data.message; + } window.ProcessMaker.alert(`${this.$t('File Upload Error:')} ${displayMessage}`, 'danger'); } diff --git a/src/components/renderer/form-collection-record-control.vue b/src/components/renderer/form-collection-record-control.vue index 9de7fb18b..701e534df 100644 --- a/src/components/renderer/form-collection-record-control.vue +++ b/src/components/renderer/form-collection-record-control.vue @@ -180,7 +180,7 @@ export default { this.selDisplayMode === "View" ? viewScreen : editScreen; this.loadScreen(this.screenCollectionId); - + //This section validates if Collection has draft data if(this.taskDraft?.draft?.data == null || this.taskDraft.draft.data === '') { this.localData = respData; @@ -213,9 +213,9 @@ export default { }, record(record) { this.hasMustache = false; - if (record && !isNaN(record) && record > 0 && this.collection) { + if (record && !isNaN(record) && record > 0 && this.collection.collectionId) { this.selRecordId = record; - this.loadRecordCollection(this.selCollectionId, record, this.collectionmode); + this.loadRecordCollection(this.collection.collectionId, record, this.selDisplayMode); } else { if (this.isMustache(record)) { this.callbackRecord(); diff --git a/src/components/renderer/form-collection-view-control.vue b/src/components/renderer/form-collection-view-control.vue index f1f84cfd6..98a3bce9c 100644 --- a/src/components/renderer/form-collection-view-control.vue +++ b/src/components/renderer/form-collection-view-control.vue @@ -206,9 +206,9 @@ export default { }, record(record) { this.hasMustache = false; - if (record && !isNaN(record) && record > 0 && this.collection) { + if (record && !isNaN(record) && record > 0 && this.collection.collectionId) { this.selRecordId = record; - this.loadRecordCollection(this.selCollectionId, record, this.collectionmode); + this.loadRecordCollection(this.collection.collectionId, record, this.collectionmode); } else { if (this.isMustache(record)) { this.callbackRecord(); diff --git a/src/components/vue-form-builder.vue b/src/components/vue-form-builder.vue index 02f7cd400..f0b0c56c6 100644 --- a/src/components/vue-form-builder.vue +++ b/src/components/vue-form-builder.vue @@ -127,6 +127,7 @@ v-if="isClipboardPage(tabPage)" variant="link" @click="clearClipboard" + class="no-text-transform" > {{ $t('Clear All') }} @@ -1745,4 +1746,7 @@ $side-bar-font-size: 0.875rem; cursor: not-allowed; /* Cambia el cursor cuando se pasa por encima */ pointer-events: all; /* Permite que el pseudo-elemento reciba eventos del ratón */ } +.no-text-transform { + text-transform: none; +} diff --git a/src/mixins/Clipboard.js b/src/mixins/Clipboard.js index 077729ff2..7e84cb4bf 100644 --- a/src/mixins/Clipboard.js +++ b/src/mixins/Clipboard.js @@ -115,6 +115,9 @@ export default { // replace uuids in clipboard content clipboardContent.forEach(this.updateUuids); page.items.splice(index, 1, ...clipboardContent); + if (clipboardContent.length) { + window.ProcessMaker.alert(this.$t("Clipboard Pasted Succesfully"), "success"); + } } if (item.items) { replaceInPage(item); @@ -144,6 +147,7 @@ export default { } ); if (confirm) { + this.clipboardPage.items = []; this.$store.dispatch("clipboardModule/clearClipboard"); this.$root.$emit('update-clipboard'); } diff --git a/tests/e2e/specs/ClipboardTabClearAll.spec.js b/tests/e2e/specs/ClipboardTabClearAll.spec.js new file mode 100644 index 000000000..561d1ac0b --- /dev/null +++ b/tests/e2e/specs/ClipboardTabClearAll.spec.js @@ -0,0 +1,42 @@ +describe("Clipboard Page and Clear All Functionality", () => { + + it("should remove all controls in the clipboard page when 'Clear All' is confirmed", () => { + // Clear local storage to ensure a clean test environment + cy.clearLocalStorage(); + + // Visit the home page + cy.visit("/"); + + // Open the 'Input Fields' accordion section + cy.openAcordeonByLabel("Input Fields"); + + // Navigate to the clipboard page + cy.get("[data-test=page-dropdown]").click(); + cy.get("[data-test=clipboard]").should("exist").click({ force: true }); + + // Step 1: Dragging controls to the screen drop zone in the clipboard + cy.get("[data-cy=controls-FormInput]").drag("[data-cy=editor-content]", { position: "bottom" }); + cy.get("[data-cy=controls-FormSelectList]").drag("[data-cy=screen-element-container]", { position: "top" }); + cy.get("[data-cy=controls-FormButton]").drag("[data-cy=screen-element-container]", { position: "top" }); + cy.get("[data-cy=controls-FormTextArea]").drag("[data-cy=screen-element-container]", { position: "top" }); + cy.get("[data-cy=controls-FormDatePicker]").drag("[data-cy=screen-element-container]", { position: "top" }); + cy.get("[data-cy=controls-FormCheckbox]").drag("[data-cy=screen-element-container]", { position: "top" }); + + // Verify that all controls have been successfully added + cy.get('[data-cy="screen-element-container"]').children().should('have.length', 6); + + // Step 2: Attempt to clear all controls but cancel the action + cy.contains('button', 'Clear All').click(); + cy.contains('button', 'Cancel').click(); + + // Ensure controls are still present after canceling + cy.get('[data-cy="screen-element-container"]').children().should('have.length', 6); + + // Step 3: Confirm clearing all controls + cy.contains('button', 'Clear All').click(); + cy.contains('button', 'Confirm').click(); + + // Validate that all controls have been removed + cy.get('[data-cy="editor-content"]').children().should('have.length', 0); + }); +});