File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff 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 ) ;
You can’t perform that action at this time.
0 commit comments