@@ -444,71 +444,5 @@ suite('WidgetDiv', function () {
444444 assert . strictEqual ( Blockly . getFocusManager ( ) . getFocusedNode ( ) , block ) ;
445445 assert . strictEqual ( document . activeElement , blockFocusableElem ) ;
446446 } ) ;
447-
448- test ( 'without auto close on lost focus lost focus does not hide widget div' , function ( ) {
449- const block = this . setUpBlockWithField ( ) ;
450- const field = Array . from ( block . getFields ( ) ) [ 0 ] ;
451- Blockly . getFocusManager ( ) . focusNode ( block ) ;
452- Blockly . WidgetDiv . show ( field , false , ( ) => { } , null , true , false ) ;
453-
454- // Focus an element outside of the widget.
455- document . getElementById ( 'nonTreeElementForEphemeralFocus' ) . focus ( ) ;
456-
457- // Even though the widget lost focus, it should still be visible.
458- const widgetDivElem = document . querySelector ( '.blocklyWidgetDiv' ) ;
459- assert . strictEqual ( widgetDivElem . style . display , 'block' ) ;
460- } ) ;
461-
462- test ( 'with auto close on lost focus lost focus hides widget div' , function ( ) {
463- const block = this . setUpBlockWithField ( ) ;
464- const field = Array . from ( block . getFields ( ) ) [ 0 ] ;
465- Blockly . getFocusManager ( ) . focusNode ( block ) ;
466- Blockly . WidgetDiv . show ( field , false , ( ) => { } , null , true , true ) ;
467-
468- // Focus an element outside of the widget.
469- document . getElementById ( 'nonTreeElementForEphemeralFocus' ) . focus ( ) ;
470-
471- // The widget should now be hidden since it lost focus.
472- const widgetDivElem = document . querySelector ( '.blocklyWidgetDiv' ) ;
473- assert . strictEqual ( widgetDivElem . style . display , 'none' ) ;
474- } ) ;
475-
476- test ( 'with auto close on lost focus lost focus with nested div hides widget div' , function ( ) {
477- const block = this . setUpBlockWithField ( ) ;
478- const field = Array . from ( block . getFields ( ) ) [ 0 ] ;
479- Blockly . getFocusManager ( ) . focusNode ( block ) ;
480- const nestedDiv = document . createElement ( 'div' ) ;
481- nestedDiv . tabIndex = - 1 ;
482- Blockly . WidgetDiv . getDiv ( ) . appendChild ( nestedDiv ) ;
483- Blockly . WidgetDiv . show ( field , false , ( ) => { } , null , true , true ) ;
484- nestedDiv . focus ( ) ; // It's valid to focus this during ephemeral focus.
485-
486- // Focus an element outside of the widget.
487- document . getElementById ( 'nonTreeElementForEphemeralFocus' ) . focus ( ) ;
488-
489- // The widget should now be hidden since it lost focus.
490- const widgetDivElem = document . querySelector ( '.blocklyWidgetDiv' ) ;
491- assert . strictEqual ( widgetDivElem . style . display , 'none' ) ;
492- } ) ;
493-
494- test ( 'with auto close on lost focus lost focus with nested div does not restore DOM focus' , function ( ) {
495- const block = this . setUpBlockWithField ( ) ;
496- const field = Array . from ( block . getFields ( ) ) [ 0 ] ;
497- Blockly . getFocusManager ( ) . focusNode ( block ) ;
498- const nestedDiv = document . createElement ( 'div' ) ;
499- nestedDiv . tabIndex = - 1 ;
500- Blockly . WidgetDiv . getDiv ( ) . appendChild ( nestedDiv ) ;
501- Blockly . WidgetDiv . show ( field , false , ( ) => { } , null , true , true ) ;
502- nestedDiv . focus ( ) ; // It's valid to focus this during ephemeral focus.
503-
504- // Focus an element outside of the widget.
505- const elem = document . getElementById ( 'nonTreeElementForEphemeralFocus' ) ;
506- elem . focus ( ) ;
507-
508- // Auto hiding should not restore focus back to the block since ephemeral
509- // focus was lost before it was returned.
510- assert . isNull ( Blockly . getFocusManager ( ) . getFocusedNode ( ) ) ;
511- assert . strictEqual ( document . activeElement , elem ) ;
512- } ) ;
513447 } ) ;
514448} ) ;
0 commit comments