Skip to content

Commit

Permalink
Merge branch 'release-2024-fall' of github.com:ProcessMaker/screen-bu…
Browse files Browse the repository at this point in the history
…ilder into bugfix/FOUR-19806
  • Loading branch information
CarliPinell committed Oct 28, 2024
2 parents 7768e0e + f32d5ff commit 9d4c105
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 5 deletions.
4 changes: 4 additions & 0 deletions src/components/renderer/file-upload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand Down
6 changes: 3 additions & 3 deletions src/components/renderer/form-collection-record-control.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions src/components/renderer/form-collection-view-control.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 4 additions & 0 deletions src/components/vue-form-builder.vue
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@
v-if="isClipboardPage(tabPage)"
variant="link"
@click="clearClipboard"
class="no-text-transform"
>
{{ $t('Clear All') }}
</b-button>
Expand Down Expand Up @@ -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;
}
</style>
4 changes: 4 additions & 0 deletions src/mixins/Clipboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -144,6 +147,7 @@ export default {
}
);
if (confirm) {
this.clipboardPage.items = [];
this.$store.dispatch("clipboardModule/clearClipboard");
this.$root.$emit('update-clipboard');
}
Expand Down
42 changes: 42 additions & 0 deletions tests/e2e/specs/ClipboardTabClearAll.spec.js
Original file line number Diff line number Diff line change
@@ -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);
});
});

0 comments on commit 9d4c105

Please sign in to comment.