This repository was archived by the owner on Apr 16, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2525 font-weight : bold;
2626 white-space : pre;
2727 }
28+ # testground {
29+ visibility : hidden;
30+ }
31+ # testground .offscreen {
32+ visibility : visible;
33+ position : absolute;
34+ left : -10000px ;
35+ top : -10000px ;
36+ }
2837 .CodeMirror { border : 1px solid black; }
2938 </ style >
3039 </ head >
@@ -39,7 +48,7 @@ <h1>CodeMirror: Test Suite</h1>
3948 < p id =status > Please enable JavaScript...</ p >
4049 < div id =output > </ div >
4150
42- < div style =" visibility: hidden " id =testground > </ div >
51+ < div id =testground > </ div >
4352
4453 < script src ="driver.js "> </ script >
4554 < script src ="test.js "> </ script >
Original file line number Diff line number Diff line change @@ -971,6 +971,22 @@ testCM("lineWidgets", function(cm) {
971971 eqPos ( cm . getCursor ( ) , { line : 1 , ch : 1 } ) ;
972972} ) ;
973973
974+ testCM ( "lineWidgetFocus" , function ( cm ) {
975+ var place = document . getElementById ( "testground" ) ;
976+ place . className = "offscreen" ;
977+ try {
978+ addDoc ( cm , 500 , 10 ) ;
979+ var node = document . createElement ( "input" ) ;
980+ var widget = cm . addLineWidget ( 1 , node ) ;
981+ node . focus ( ) ;
982+ eq ( document . activeElement , node ) ;
983+ cm . replaceRange ( "new stuff" , { line : 1 , ch : 0 } ) ;
984+ eq ( document . activeElement , node ) ;
985+ } finally {
986+ place . className = "" ;
987+ }
988+ } ) ;
989+
974990testCM ( "getLineNumber" , function ( cm ) {
975991 addDoc ( cm , 2 , 20 ) ;
976992 var h1 = cm . getLineHandle ( 1 ) ;
You can’t perform that action at this time.
0 commit comments