Skip to content

Commit

Permalink
Merge pull request #6778 from surveyjs/bug/service-1346-ranking-at-cr…
Browse files Browse the repository at this point in the history
…eator-landing

PR: Survey Creator landing: Drag and drop doesn't work
  • Loading branch information
dmitry-kurmanov authored Aug 25, 2023
2 parents ded3f88 + b3e1d2f commit 80f051d
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/dragdrop/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,12 @@ export abstract class DragDropCore<T> implements IDragDropEngine {
protected doBanDropHere = (): void => { };

protected findDropTargetNodeFromPoint(clientX: number, clientY: number): HTMLElement {
this.domAdapter.draggedElementShortcut.hidden = true;
const displayProp = this.domAdapter.draggedElementShortcut.style.display;
//this.domAdapter.draggedElementShortcut.hidden = true;
this.domAdapter.draggedElementShortcut.style.display = "none";
let dragOverNode = <HTMLElement>document.elementFromPoint(clientX, clientY);
this.domAdapter.draggedElementShortcut.hidden = false;
// this.domAdapter.draggedElementShortcut.hidden = false;
this.domAdapter.draggedElementShortcut.style.display = displayProp || "block";

if (!dragOverNode) return null;

Expand Down
28 changes: 28 additions & 0 deletions testCafe/questions/ranking.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,4 +281,32 @@ frameworks.forEach((framework) => {
"one"
]);
});

test("ranking: work with flexbox layout", async (t) => {
const addFlexboxLayout = ClientFunction(() => {
const stylesheet = document.styleSheets[0];
stylesheet.addRule(".sv-ranking.sv-ranking.sv-ranking.sv-ranking.sv-ranking", "display:flex;flex-direction: column", 0);
});
const removeFlexboxLayout = ClientFunction(() => {
const stylesheet = document.styleSheets[0];
stylesheet.removeRule(0);
});

await addFlexboxLayout();

await t.dragToElement(PriceItem, BatteryItem);

let data = await getData();
await t.expect(data["smartphone-features"]).eql([
"Price",
"Battery life",
"Screen size",
"Storage space",
"Camera quality",
"Durability",
"Processor power",
]);

await removeFlexboxLayout();
});
});

0 comments on commit 80f051d

Please sign in to comment.