Merge pull request #3135 from storytouch/develop

[fix] Fix drag and drop tests for IE
This commit is contained in:
Luiza Pagliari 2017-02-03 06:48:26 -02:00 committed by GitHub
commit 1500ed63f0
1 changed files with 10 additions and 2 deletions

View File

@ -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);
}
});