Skip to content

Commit

Permalink
work for the #7935 (#7941)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitry-kurmanov authored Mar 11, 2024
1 parent a9c349a commit 4dae403
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/dragdrop/ranking-select-to-rank.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,11 @@ export class DragDropRankingSelectToRank extends DragDropRankingChoices {
return dragOverNode;
}

if (
this.parentElement.rankingChoices.length === 0 ||
this.parentElement.unRankingChoices.length === 0
) {
let toContainer: HTMLElement = dragOverNode.closest("[data-ranking='to-container']");
let fromContainer: HTMLElement = dragOverNode.closest("[data-ranking='from-container']");

if (!!toContainer) return toContainer;
if (!!fromContainer) return fromContainer;
}
let toContainer: HTMLElement = dragOverNode.closest("[data-ranking='to-container']");
let fromContainer: HTMLElement = dragOverNode.closest("[data-ranking='from-container']");

if (this.parentElement.unRankingChoices.length === 0 && fromContainer) return fromContainer;
if (this.parentElement.rankingChoices.length === 0 && toContainer) return toContainer;

return super.findDropTargetNodeByDragOverNode(dragOverNode);
}
Expand Down
6 changes: 6 additions & 0 deletions tests/dragdrophelpertests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,12 @@ QUnit.test("DragDropRankingSelectToRank getIndixies", function (assert) {
assert.equal(toIndex, 2);
toIndex = dndModel.getIndixies(questionModel, questionModel.rankingChoices, questionModel.rankingChoices).toIndex;
assert.equal(toIndex, 1);

questionModel.value = ["11", "22", "33"];
dndModel.draggedElement = questionModel.rankingChoices[0];
dndModel.dropTarget = questionModel.rankingChoices[1];
toIndex = dndModel.getIndixies(questionModel, questionModel.rankingChoices, questionModel.rankingChoices).toIndex;
assert.equal(toIndex, 1);
});
// EO selectToRankEnabled

Expand Down

0 comments on commit 4dae403

Please sign in to comment.