Skip to content

Commit

Permalink
Merge pull request #248 from zimmerman-team/feat/DX-1924
Browse files Browse the repository at this point in the history
feat: DX-1924 - Issue with reordering rowframe
  • Loading branch information
okorie2 authored Oct 7, 2024
2 parents 69471db + 2c5410b commit e243268
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 29 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
59 changes: 31 additions & 28 deletions cypress/e2e/1-dx/4-reports.cy.ts → cypress/e2e/4-reports.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -343,34 +343,6 @@ describe("Edit, duplicate and delete report", () => {
).should("be.visible");
});

// it("Can drag and drop rows in a report", () => {
// cy.get("[data-cy=home-search-button]").click();
// cy.wait(2000);
// cy.get("[data-cy=filter-search-input]").type(
// `{selectall}{backspace}${reportTestName}`
// );

// cy.wait("@fetchReports");

// cy.contains('[data-cy="report-grid-item"]', `${reportTestName} - Edited`)
// .first()
// .scrollIntoView()
// .within(() => {
// cy.get('[data-cy="report-grid-item-menu-btn"]').click();
// });

// cy.intercept(`${apiUrl}/report/*`).as("fetchReport");

// cy.get('[data-cy="report-grid-item-edit-btn"]').click();

// cy.wait("@fetchReport");

// cy.get('[data-cy="row-frame-container-0"]').within(() => {
// cy.get('[data-cy="row-frame-handle"]').drag();
// });
// cy.get('[data-cy="report-row-placeholder"]').eq(2).scrollIntoView().drop();
// });

it("Can delete an item from a box in a row", () => {
cy.get("[data-cy=home-search-button]").click();
cy.wait(2000);
Expand Down Expand Up @@ -590,6 +562,37 @@ describe("Edit, duplicate and delete report", () => {
});

cy.get('[data-cy="row-frame-chart-item-0-1"]').should("have.length", 0);
cy.wait(5000);
});

it("Can drag and drop rows in a report", () => {
cy.get("[data-cy=home-search-button]").click();
cy.wait(2000);
cy.get("[data-cy=filter-search-input]").type(
`{selectall}{backspace}${reportTestName}`
);

cy.wait("@fetchReports");

cy.contains('[data-cy="report-grid-item"]', `${reportTestName} - Edited`)
.first()
.scrollIntoView()
.within(() => {
cy.get('[data-cy="report-grid-item-menu-btn"]').click();
});

cy.intercept(`${apiUrl}/report/*`).as("fetchReport");

cy.get('[data-cy="report-grid-item-edit-btn"]').click();

cy.wait("@fetchReport");

cy.get('[data-cy="row-frame-container-0"]').within(() => {
cy.get('[data-cy="row-frame-handle"]').drag();
});
cy.get('[data-cy="report-row-placeholder"]').eq(2).scrollIntoView().drop();
cy.get('[data-cy="row-frame-text-item-0-0"]').should("have.length", 0);
cy.wait(5000);
});

it("Can delete a report", () => {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const PlaceHolder = (props: PlaceholderProps) => {
props.index ?? draft.findIndex((frame) => frame.id === props.rowId) + 1;

const fakeId = v4();
const tempItem = draft[dragIndex];
const tempItem = { ...draft[dragIndex] };
draft[dragIndex].id = fakeId;

draft.splice(dropIndex, 0, tempItem);
Expand Down

0 comments on commit e243268

Please sign in to comment.