Created
January 22, 2021 13:24
-
-
Save web-padawan/a124e7cf90b5c252f0731c2d617ab6d7 to your computer and use it in GitHub Desktop.
patch to support Shadow DOM
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/node_modules/@4tw/cypress-drag-drop/index.js b/node_modules/@4tw/cypress-drag-drop/index.js | |
index efde88e..05a0733 100644 | |
--- a/node_modules/@4tw/cypress-drag-drop/index.js | |
+++ b/node_modules/@4tw/cypress-drag-drop/index.js | |
@@ -1,7 +1,7 @@ | |
const dataTransfer = new DataTransfer() | |
function isAttached(element) { | |
- return !!element.closest('html') | |
+ return element.isConnected; | |
} | |
const DragSimulator = { | |
@@ -30,10 +30,10 @@ const DragSimulator = { | |
.wrap(this.source) | |
.trigger('pointerdown', { which: 1, button: 0, force: this.force, clientX, clientY, position: this.position }) | |
.trigger('mousedown', { which: 1, button: 0, force: this.force, clientX, clientY, position: this.position }) | |
- .trigger('dragstart', { dataTransfer, force: this.force, position: this.position }) | |
+ .trigger('dragstart', { dataTransfer, force: this.force, position: this.position, composed: true }) | |
}, | |
drop({ clientX, clientY } = {}) { | |
- return this.target.trigger('drop', { dataTransfer, force: this.force, position: this.position }).then(() => { | |
+ return this.target.trigger('drop', { dataTransfer, force: this.force, position: this.position, composed: true }).then(() => { | |
if (isAttached(this.targetElement)) { | |
this.target | |
.trigger('mouseup', { which: 1, button: 0, force: this.force, clientX, clientY, position: this.position }) | |
@@ -60,6 +60,7 @@ const DragSimulator = { | |
dataTransfer, | |
position: this.position, | |
force: this.force, | |
+ composed: true | |
}) | |
.trigger('mousemove', { | |
force: this.force, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment