@@ -17,7 +17,7 @@ describe('overlay', () => {
1717 } ;
1818 await nextRender ( ) ;
1919 overlay = menu . _overlayElement ;
20- content = overlay . $ . overlay . children [ 0 ] ;
20+ content = overlay . $ . content ;
2121 // Make content have a fixed size
2222 content . style . height = content . style . width = '100px' ;
2323 content . style . boxSizing = 'border-box' ;
@@ -233,7 +233,7 @@ describe('overlay', () => {
233233 } ) ;
234234 } ) ;
235235
236- ( isIOS ? describe . skip : describe ) ( `[dir=${ direction } ] position` , ( ) => {
236+ describe ( `[dir=${ direction } ] position` , ( ) => {
237237 let isRTL ;
238238 before ( async ( ) => {
239239 isRTL = direction === 'rtl' ;
@@ -278,11 +278,12 @@ describe('overlay', () => {
278278 contextmenu ( viewWidth , viewHeight ) ;
279279 await oneEvent ( overlay , 'vaadin-overlay-open' ) ;
280280
281+ const border = parseInt ( getComputedStyle ( overlay . $ . overlay ) . borderWidth ) ;
281282 const rect = content . getBoundingClientRect ( ) ;
282283 expect ( rect . width ) . to . be . closeTo ( 100 , 0.5 ) ;
283284 expect ( rect . height ) . to . be . closeTo ( 100 , 0.5 ) ;
284- expect ( rect . left ) . to . be . closeTo ( viewWidth - 100 , 0.5 ) ;
285- expect ( rect . top ) . to . be . closeTo ( viewHeight - 100 , 0.5 ) ;
285+ expect ( rect . left ) . to . be . closeTo ( viewWidth - 100 - border , 0.5 ) ;
286+ expect ( rect . top ) . to . be . closeTo ( viewHeight - 100 - border , 0.5 ) ;
286287 } ) ;
287288
288289 it ( 'should reset css properties and attributes on each open' , async ( ) => {
@@ -294,9 +295,10 @@ describe('overlay', () => {
294295 contextmenu ( 16 , 16 ) ;
295296 await oneEvent ( overlay , 'vaadin-overlay-open' ) ;
296297
298+ const border = parseInt ( getComputedStyle ( overlay . $ . overlay ) . borderWidth ) ;
297299 const rect = content . getBoundingClientRect ( ) ;
298- expect ( rect . left ) . to . be . closeTo ( 16 , 0.5 ) ;
299- expect ( rect . top ) . to . be . closeTo ( 16 , 0.5 ) ;
300+ expect ( rect . left ) . to . be . closeTo ( 16 + border , 0.5 ) ;
301+ expect ( rect . top ) . to . be . closeTo ( 16 + border , 0.5 ) ;
300302 expect ( overlay . hasAttribute ( 'end-aligned' ) ) . to . equal ( isRTL ) ;
301303 expect ( overlay . hasAttribute ( 'bottom-aligned' ) ) . to . be . false ;
302304 expect ( overlay . style . right ) . to . be . empty ;
@@ -307,9 +309,10 @@ describe('overlay', () => {
307309 contextmenu ( viewWidth * 1.1 , viewHeight * 1.1 ) ;
308310 await oneEvent ( overlay , 'vaadin-overlay-open' ) ;
309311
312+ const border = parseInt ( getComputedStyle ( overlay . $ . overlay ) . borderWidth ) ;
310313 const rect = content . getBoundingClientRect ( ) ;
311- expect ( rect . left ) . to . be . closeTo ( viewWidth - 100 , 0.5 ) ;
312- expect ( rect . top ) . to . be . closeTo ( viewHeight - 100 , 0.5 ) ;
314+ expect ( rect . left ) . to . be . closeTo ( viewWidth - 100 - border , 0.5 ) ;
315+ expect ( rect . top ) . to . be . closeTo ( viewHeight - 100 - border , 0.5 ) ;
313316 } ) ;
314317 } ) ;
315318 } ) ;
@@ -356,7 +359,7 @@ describe('overlay', () => {
356359
357360 it ( 'should close on menu contextmenu' , ( ) => {
358361 // Dispatch a contextmenu event on the overlay content
359- const { left, top } = overlay . $ . content . getBoundingClientRect ( ) ;
362+ const { left, top } = content . getBoundingClientRect ( ) ;
360363 const e = contextmenu ( left , top , false , overlay ) ;
361364 expect ( e . defaultPrevented ) . to . be . true ;
362365 expect ( menu . opened ) . to . be . false ;
@@ -444,17 +447,18 @@ describe('overlay', () => {
444447 expect ( contextMenuSpy . calledOnce ) . to . be . true ;
445448 } ) ;
446449
447- it ( 'should re-open to correct coodrinates ' , async ( ) => {
450+ it ( 'should re-open to correct coordinates ' , async ( ) => {
448451 // Move the target to another location
449452 target . style . margin = '200px' ;
450453
451454 const { left, top } = target . getBoundingClientRect ( ) ;
452455 contextmenu ( left , top , false , document . documentElement ) ;
453- await nextFrame ( ) ;
456+ await oneEvent ( overlay , 'vaadin-overlay-open' ) ;
454457
455- const contentRect = overlay . $ . content . getBoundingClientRect ( ) ;
456- expect ( contentRect . left ) . to . equal ( left ) ;
457- expect ( contentRect . top ) . to . equal ( top ) ;
458+ const border = parseInt ( getComputedStyle ( overlay . $ . overlay ) . borderWidth ) ;
459+ const contentRect = content . getBoundingClientRect ( ) ;
460+ expect ( contentRect . left ) . to . equal ( left + border ) ;
461+ expect ( contentRect . top ) . to . equal ( top + border ) ;
458462 } ) ;
459463
460464 it ( 'should cancel the synthetic contextmenu event' , async ( ) => {
0 commit comments