## Description 1. Shifts DSL migration logic to @shared/dsl 2. Exposes /migrate/dsl endpoint on rts 3. Integrates RTS endpoint to backend for serving migrated pages 4. Introduces feature flag to switch between client-based and server-based on-demand migration #### PR fixes following issue(s) Fixes #26783, #26784, #26980 #### Type of change - New feature (non-breaking change which adds functionality) ## Testing > #### How Has This Been Tested? > Please describe the tests that you ran to verify your changes. Also list any relevant details for your test configuration. > Delete anything that is not relevant - [x] Manual - [ ] JUnit - [x] Jest - [x] Cypress > > #### Test Plan > Add Testsmith test cases links that relate to this PR > > #### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) > > > ## Checklist: #### Dev activity - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag #### QA activity: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed --------- Co-authored-by: Nayan <nayan@appsmith.com>
98 lines
2.2 KiB
TypeScript
98 lines
2.2 KiB
TypeScript
import {
|
|
getDraggingSpacesFromBlocks,
|
|
getMousePositionsOnCanvas,
|
|
} from "./WidgetPropsUtils";
|
|
import type { WidgetDraggingBlock } from "layoutSystems/common/canvasArenas/ArenaTypes";
|
|
|
|
describe("WidgetProps tests", () => {
|
|
it("should convert WidgetDraggingBlocks to occupied Spaces", () => {
|
|
const draggingBlocks: WidgetDraggingBlock[] = [
|
|
{
|
|
left: 100,
|
|
top: 100,
|
|
width: 210,
|
|
height: 220,
|
|
widgetId: "1",
|
|
isNotColliding: true,
|
|
columnWidth: 10,
|
|
rowHeight: 10,
|
|
type: "",
|
|
},
|
|
{
|
|
left: 310,
|
|
top: 120,
|
|
width: 70,
|
|
height: 80,
|
|
widgetId: "2",
|
|
isNotColliding: true,
|
|
columnWidth: 10,
|
|
rowHeight: 10,
|
|
type: "",
|
|
},
|
|
];
|
|
const draggingSpaces = [
|
|
{
|
|
left: 10,
|
|
top: 10,
|
|
right: 31,
|
|
bottom: 32,
|
|
id: "1",
|
|
},
|
|
{
|
|
left: 31,
|
|
top: 12,
|
|
right: 38,
|
|
bottom: 20,
|
|
id: "2",
|
|
},
|
|
];
|
|
const snapColumnSpace = 10,
|
|
snapRowSpace = 10;
|
|
|
|
expect(
|
|
getDraggingSpacesFromBlocks(
|
|
draggingBlocks,
|
|
snapColumnSpace,
|
|
snapRowSpace,
|
|
),
|
|
).toEqual(draggingSpaces);
|
|
});
|
|
it("getMousePositionsOnCanvas should Return Mouse Position relative to Canvas", () => {
|
|
const gridProps = {
|
|
parentColumnSpace: 10,
|
|
parentRowSpace: 10,
|
|
maxGridColumns: 64,
|
|
};
|
|
const mouseEvent = {
|
|
offsetX: 500,
|
|
offsetY: 600,
|
|
} as unknown as MouseEvent;
|
|
expect(getMousePositionsOnCanvas(mouseEvent, gridProps)).toEqual({
|
|
id: "mouse",
|
|
top: 59,
|
|
left: 49,
|
|
bottom: 60,
|
|
right: 50,
|
|
});
|
|
});
|
|
|
|
it("getMousePositionsOnCanvas should even return negative Mouse Position relative to Canvas", () => {
|
|
const gridProps = {
|
|
parentColumnSpace: 10,
|
|
parentRowSpace: 10,
|
|
maxGridColumns: 64,
|
|
};
|
|
const mouseEvent = {
|
|
offsetX: 2,
|
|
offsetY: 5,
|
|
} as unknown as MouseEvent;
|
|
expect(getMousePositionsOnCanvas(mouseEvent, gridProps)).toEqual({
|
|
id: "mouse",
|
|
top: -1,
|
|
left: -1,
|
|
bottom: 0,
|
|
right: 0,
|
|
});
|
|
});
|
|
});
|