1
1
import { expect } from '@esm-bundle/chai' ;
2
- import { fixtureSync , nextRender } from '@vaadin/testing-helpers' ;
2
+ import { aTimeout , fixtureSync , nextRender } from '@vaadin/testing-helpers' ;
3
3
import { setViewport } from '@web/test-runner-commands' ;
4
4
import '../vaadin-crud.js' ;
5
5
import { flushGrid } from './helpers.js' ;
@@ -11,6 +11,16 @@ describe('crud editor', () => {
11
11
await setViewport ( { width : 1024 , height : 768 } ) ;
12
12
} ) ;
13
13
14
+ afterEach ( async ( ) => {
15
+ // Wait until the crud dialog overlay is closed
16
+ let overlay ;
17
+ while ( ( overlay = document . querySelector ( 'body > vaadin-crud-dialog-overlay' ) ) ) {
18
+ // Press esc to close the dialog
19
+ overlay . dispatchEvent ( new KeyboardEvent ( 'keydown' , { key : 'Escape' , bubbles : true } ) ) ;
20
+ await aTimeout ( 1 ) ;
21
+ }
22
+ } ) ;
23
+
14
24
describe ( 'header' , ( ) => {
15
25
let header ;
16
26
@@ -122,6 +132,22 @@ describe('crud editor', () => {
122
132
expect ( form . parentElement ) . to . be . null ;
123
133
expect ( newForm . parentElement ) . to . equal ( overlay ) ;
124
134
} ) ;
135
+
136
+ it ( 'should not cover the editor content with focus ring element' , async ( ) => {
137
+ // Open the editor
138
+ crud . editorPosition = 'aside' ;
139
+ crud . _newButton . click ( ) ;
140
+ await nextRender ( ) ;
141
+
142
+ // Get the elementFromPoint of the editor header
143
+ const header = crud . querySelector ( '[slot=header]' ) ;
144
+ const headerRect = header . getBoundingClientRect ( ) ;
145
+ const x = headerRect . left + headerRect . width / 2 ;
146
+ const y = headerRect . top + headerRect . height / 2 ;
147
+ const elementFromPoint = document . elementFromPoint ( x , y ) ;
148
+
149
+ expect ( elementFromPoint ) . to . equal ( header ) ;
150
+ } ) ;
125
151
} ) ;
126
152
} ) ;
127
153
} ) ;
0 commit comments