summaryrefslogtreecommitdiff
path: root/tests/frontend
diff options
context:
space:
mode:
authorLuiza Pagliari <lpagliari@gmail.com>2017-02-03 06:47:33 -0200
committerLuiza Pagliari <lpagliari@gmail.com>2017-02-03 06:47:33 -0200
commit02bd4a31afc09e594dd2d305ca6eb91065c9f798 (patch)
tree227cc64730257417a79400474c260588c4caaccf /tests/frontend
parenta6436ac8d293807de6f0f0b2ed368411dc859cd0 (diff)
downloadetherpad-lite-02bd4a31afc09e594dd2d305ca6eb91065c9f798.zip
[fix] Fix drag and drop tests for IE
Diffstat (limited to 'tests/frontend')
-rw-r--r--tests/frontend/specs/drag_and_drop.js12
1 files changed, 10 insertions, 2 deletions
diff --git a/tests/frontend/specs/drag_and_drop.js b/tests/frontend/specs/drag_and_drop.js
index bcec0bd2..821d3aac 100644
--- a/tests/frontend/specs/drag_and_drop.js
+++ b/tests/frontend/specs/drag_and_drop.js
@@ -154,7 +154,15 @@ describe('drag and drop', function() {
var $target = getLine(targetLineNumber);
$target.sendkeys('{selectall}{rightarrow}{leftarrow}');
- // insert content
- innerDocument.execCommand('insertHTML', false, draggedHtml);
+ // Insert content.
+ // Based on http://stackoverflow.com/a/6691294, to be IE-compatible
+ var range = innerDocument.getSelection().getRangeAt(0);
+ var frag = innerDocument.createDocumentFragment();
+ var el = innerDocument.createElement('div');
+ el.innerHTML = draggedHtml;
+ while (el.firstChild) {
+ frag.appendChild(el.firstChild);
+ }
+ range.insertNode(frag);
}
});