Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
webloopbox committed Dec 12, 2024
2 parents cc26fa4 + 4f902bb commit e1a37a5
Show file tree
Hide file tree
Showing 18 changed files with 13,416 additions and 9,438 deletions.
62 changes: 59 additions & 3 deletions cypress/e2e/common/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -672,8 +672,12 @@ export class Utilities {
return cy.get(".rg-shadow");
}

resizeHint() {
return cy.get(".rg-column-resize-hint");
resizeHintColumn() {
return cy.get(`.rg-column-resize-hint`);
}

resizeHintRow() {
return cy.get(`.rg-row-resize-hint`);
}

getRightStickyPane() {
Expand Down Expand Up @@ -850,7 +854,7 @@ export class Utilities {
});
}
this.getLine().should("exist");
this.resizeHint().should("exist");
this.resizeHintColumn().should("exist");
beforePointerUp();
body.trigger("pointerup", {
clientX: endingPoint + offsetLeft,
Expand All @@ -864,6 +868,58 @@ export class Utilities {
cy.wait(200);
}

resizeRow(
startX: number,
startY: number,
distance: number,
options?: ResizeParams
) {
const { log, resizeHandleClickOffset, step, beforePointerUp } = {
log: false,
resizeHandleClickOffset: 4, // probably need check
step: 1,
beforePointerUp: () => null,
...options,
};
const endingPoint = startY + distance + resizeHandleClickOffset;
const scrollableElement = this.getScrollableElement();
scrollableElement.then(($el) => {
const { offsetLeft, offsetTop } = $el[0];
const body = this.getBody();
scrollableElement.trigger(
"pointerdown",
startX + offsetLeft,
startY - resizeHandleClickOffset + offsetTop,
{ log, pointerType: options?.useTouch ? "touch" : "mouse" }
);
for (
let y = startY;
distance < 0 ? y > endingPoint : y < endingPoint;
y += distance > 0 ? step : -step
) {
body
.wait(3, { log: false })
.trigger("pointermove", startX + offsetLeft, y + offsetTop, {
log,
force: true,
pointerType: options?.useTouch ? "touch" : "mouse",
});
}
this.getLine().should("exist");
this.resizeHintRow().should("exist");
beforePointerUp();
body.trigger("pointerup", {
clientX: startX + offsetLeft,
clientY: endingPoint + offsetTop,
force: true,
log,
pointerType: options?.useTouch ? "touch" : "mouse",
});
});

cy.wait(200);
}

reorderColumn(
startX: number,
startY: number,
Expand Down
5 changes: 3 additions & 2 deletions cypress/e2e/tests/columnAndRowSelections/scroll.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ context("Scroll", () => {
utils.resizeColumn(config.cellWidth, utils.getCellYCenter(), RESIZE_WIDTH, {
useTouch: true,
beforePointerUp: () => {
utils.resizeHint().should("be.visible");
utils.resizeHintColumn().should("be.visible");
utils
.resizeHint()
.resizeHintColumn()
.and("contain.text", `Width: ${NEW_WIDTH + 5 /* 5px is the resize handle offset */}px`);
},
});
Expand All @@ -57,4 +57,5 @@ context("Scroll", () => {
utils.getScrollableElement().should("have.prop", "scrollLeft", 0);
utils.getScrollableElement().should("have.prop", "scrollTop", 0);
});

});
47 changes: 38 additions & 9 deletions cypress/e2e/tests/standard/resize.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ context("Resize", () => {
utils.scrollTo(SCROLL, 0);
utils.resizeColumn(SCROLL + (SCROLL % config.cellWidth), 1, RESIZE_WIDTH, {
beforePointerUp: () => {
utils.resizeHint().should("be.visible");
utils.resizeHintColumn().should("be.visible");
// 🟠 TODO - hint should contain exact value
// utils.resizeHint().and('contain.text', `Width: ${config.cellWidth + RESIZE_WIDTH}px`)
// utils.resizeHintColumn().and('contain.text', `Width: ${config.cellWidth + RESIZE_WIDTH}px`)
},
});

Expand All @@ -33,9 +33,9 @@ context("Resize", () => {
-RESIZE_WIDTH,
{
beforePointerUp: () => {
utils.resizeHint().should("be.visible");
utils.resizeHintColumn().should("be.visible");
// 🟠 TODO - hint should contain exact value
// utils.resizeHint().and('contain.text', `Width: ${config.cellWidth}px`)
// utils.resizeHintColumn().and('contain.text', `Width: ${config.cellWidth}px`)
},
}
);
Expand All @@ -48,9 +48,9 @@ context("Resize", () => {

utils.resizeColumn(config.cellWidth, utils.getCellYCenter(), RESIZE_WIDTH, {
beforePointerUp: () => {
utils.resizeHint().should("be.visible");
utils.resizeHintColumn().should("be.visible");
utils
.resizeHint()
.resizeHintColumn()
.and("contain.text", `Width: ${config.minCellWidth}px`);
},
});
Expand All @@ -74,9 +74,9 @@ context("Resize", () => {
{
// 17 px - scroll width
beforePointerUp: () => {
utils.resizeHint().should("be.visible");
utils.resizeHintColumn().should("be.visible");
utils
.resizeHint()
.resizeHintColumn()
.and("contain.text", `Width: ${config.minCellWidth}px`);
},
}
Expand Down Expand Up @@ -105,7 +105,7 @@ context("Resize", () => {
// 17 px - scroll width
beforePointerUp: () => {
// 🟠 TODO - hint should contain exact value
utils.resizeHint().and('contain.text', `Width: ${config.cellWidth + RESIZE_WIDTH + 3}px`)
utils.resizeHintColumn().and('contain.text', `Width: ${config.cellWidth + RESIZE_WIDTH + 3}px`)
},
}
);
Expand All @@ -115,4 +115,33 @@ context("Resize", () => {
config.cellWidth + RESIZE_WIDTH
);
});

it("Should increase and reduce row height on scrolled view with content in vertical axis", () => { // ✅
const RESIZE_HEIGHT = 100;
const SCROLL = 15;

utils.scrollTo(0, SCROLL);
utils.resizeRow(1, SCROLL + (SCROLL % config.cellHeight), RESIZE_HEIGHT, {
beforePointerUp: () => {
utils.resizeHintRow().should("be.visible");
utils.resizeHintRow().and('contain.text', `Height: ${config.cellHeight + RESIZE_HEIGHT+1}px`)
},
});

utils.assertElementHeightIsEqual(
utils.getCell(0, 0),
config.cellHeight + RESIZE_HEIGHT
);

utils.resizeRow(1, SCROLL + RESIZE_HEIGHT + (SCROLL % config.cellHeight), -RESIZE_HEIGHT, {
beforePointerUp: () => {
utils.resizeHintRow().should("be.visible");
utils.resizeHintRow().and('contain.text', `Height: ${config.cellHeight+3}px`)
},
});

utils.assertElementHeightIsEqual(utils.getCell(0, 0), config.cellHeight);

});

});
45 changes: 45 additions & 0 deletions cypress/e2e/tests/sticky/resize.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,49 @@ context("Resize", () => {
config.cellWidth + RESIZE_WIDTH
);
});

// rows height
it("should increase and reduce row height on scrolled view with content in vertical axis", () => {
// ✅
const RESIZE_HEIGHT = config.cellHeight;

utils.scrollTo(0, 200);
utils.resizeRow(
utils.getCellXCenter(),
config.cellHeight - 2,
RESIZE_HEIGHT
);
cy.wait(200);

utils.assertElementHeightIsEqual(
utils.getCell(0, 0),
config.cellHeight + RESIZE_HEIGHT
);

utils.resizeRow(
utils.getCellXCenter(),
config.cellHeight + RESIZE_HEIGHT,
-RESIZE_HEIGHT
);
cy.wait(200);

utils.assertElementHeightIsEqual(utils.getCell(0, 0), config.cellHeight);
});

it("should shrink row height to min height", () => {
// ✅
const RESIZE_HEIGHT = -config.cellHeight;

utils.scrollTo(0, 20);
utils.resizeRow(
utils.getCellXCenter(),
config.cellHeight,
RESIZE_HEIGHT
);
cy.wait(200);

utils.assertElementHeightIsEqual(utils.getCell(0, 0), config.minCellHeight);

});

});
Loading

0 comments on commit e1a37a5

Please sign in to comment.