Skip to content

Commit 2e7018b

Browse files
committed
test: attempt to fix failing Opera 11 test
1 parent 62bc305 commit 2e7018b

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

test/test.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,18 @@ describe('get-window', function () {
4646
// skip on IE <= 8
4747
if ('function' === typeof window.getSelection) {
4848
it('should work with a DOM Selection instance', function () {
49-
var sel = window.getSelection();
50-
5149
// NOTE: a Selection needs to have some kind of selection on it
5250
// (i.e. not `type: "None"`) in order for a Document to be found
5351
var range = document.createRange();
54-
range.selectNode(document.body);
52+
var t = document.createTextNode('t');
53+
document.body.appendChild(t);
54+
range.setStart(t, 0);
55+
range.setEnd(t, t.nodeValue.length);
56+
57+
var sel = window.getSelection();
5558
sel.removeAllRanges();
5659
sel.addRange(range);
60+
assert.equal(1, sel.rangeCount);
5761

5862
var win = getWindow(sel);
5963
assert(win === window);

0 commit comments

Comments
 (0)