@@ -15,14 +15,14 @@ describe('a11y', () => {
1515
1616 function focusRestorationTests ( testId , createFixture ) {
1717 describe ( `focus restoration - ${ testId } ` , ( ) => {
18- let grid , form , overlay , newButton , saveButton , cancelButton , editButtons ;
18+ let grid , form , dialog , newButton , saveButton , cancelButton , editButtons ;
1919
2020 describe ( 'create item' , ( ) => {
2121 beforeEach ( async ( ) => {
2222 crud = createFixture ( ) ;
2323 crud . items = [ { title : 'Item 1' } ] ;
2424 await nextRender ( ) ;
25- overlay = getDialogEditor ( crud ) . $ . overlay ;
25+ dialog = getDialogEditor ( crud ) ;
2626 form = crud . querySelector ( 'vaadin-crud-form' ) ;
2727 newButton = crud . querySelector ( '[slot=new-button]' ) ;
2828 saveButton = crud . querySelector ( '[slot=save-button]' ) ;
@@ -34,7 +34,7 @@ describe('a11y', () => {
3434 newButton . focus ( ) ;
3535 newButton . click ( ) ;
3636 await nextRender ( ) ;
37- expect ( getDeepActiveElement ( ) ) . to . equal ( overlay . $ . overlay ) ;
37+ expect ( getDeepActiveElement ( ) ) . to . equal ( dialog ) ;
3838 } ) ;
3939
4040 it ( 'should restore focus to previous element on new dialog close' , async ( ) => {
@@ -327,73 +327,4 @@ describe('a11y', () => {
327327 expect ( dialog . getAttribute ( 'aria-label' ) ) . to . equal ( 'Edit item' ) ;
328328 } ) ;
329329 } ) ;
330-
331- describe ( 'modal dialog' , ( ) => {
332- let dialog , grid , header , form , newButton , saveButton , cancelButton , deleteButton , sibling ;
333-
334- beforeEach ( async ( ) => {
335- crud = fixtureSync ( '<vaadin-crud></vaadin-crud>' ) ;
336- crud . items = [ { title : 'Item 1' } ] ;
337-
338- dialog = getDialogEditor ( crud ) ;
339- grid = crud . querySelector ( '[slot="grid"]' ) ;
340- header = crud . querySelector ( '[slot="header"]' ) ;
341- form = crud . querySelector ( '[slot="form"]' ) ;
342- newButton = crud . querySelector ( '[slot="new-button"]' ) ;
343- saveButton = crud . querySelector ( '[slot="save-button"]' ) ;
344- cancelButton = crud . querySelector ( '[slot="cancel-button"]' ) ;
345- deleteButton = crud . querySelector ( '[slot="delete-button"]' ) ;
346-
347- sibling = fixtureSync ( '<button></button>' ) ;
348- await nextRender ( ) ;
349- } ) ;
350-
351- it ( 'should hide all elements outside of the dialog when opened' , async ( ) => {
352- crud . _newButton . click ( ) ;
353- await nextRender ( ) ;
354-
355- // Sibling elements of CRUD must be hidden
356- expect ( sibling . parentElement . getAttribute ( 'aria-hidden' ) ) . to . equal ( 'true' ) ;
357-
358- // Hierarchy to dialog must not be hidden
359- [ crud . parentElement , crud , dialog , dialog . $ . overlay ] . forEach ( ( el ) => {
360- expect ( el . hasAttribute ( 'aria-hidden' ) ) . to . be . false ;
361- } ) ;
362-
363- // Elements slotted into the dialog must not be hidden
364- [ header , form , saveButton , cancelButton , deleteButton ] . forEach ( ( el ) => {
365- expect ( el . hasAttribute ( 'aria-hidden' ) ) . to . be . false ;
366- } ) ;
367-
368- // Elements not slotted into the dialog must be hidden
369- [ grid , newButton ] . forEach ( ( el ) => {
370- expect ( el . getAttribute ( 'aria-hidden' ) ) . to . equal ( 'true' ) ;
371- } ) ;
372- } ) ;
373-
374- it ( 'should restore visibility of elements outside of the dialog when closed' , async ( ) => {
375- crud . _newButton . click ( ) ;
376- await nextRender ( ) ;
377-
378- // Close the dialog
379- await sendKeys ( { press : 'Escape' } ) ;
380-
381- [
382- sibling . parentElement ,
383- crud . parentElement ,
384- crud ,
385- dialog ,
386- dialog . $ . overlay ,
387- header ,
388- form ,
389- saveButton ,
390- cancelButton ,
391- deleteButton ,
392- grid ,
393- newButton ,
394- ] . forEach ( ( el ) => {
395- expect ( el . hasAttribute ( 'aria-hidden' ) ) . to . be . false ;
396- } ) ;
397- } ) ;
398- } ) ;
399330} ) ;
0 commit comments