File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -38,4 +38,19 @@ test.describe("Popover", () => {
3838 / b x - - p o p o v e r - - o p e n / ,
3939 ) ;
4040 } ) ;
41+
42+ test ( "popover content is visible in viewport when open" , async ( { page } ) => {
43+ await page . getByTestId ( "open-popover" ) . click ( ) ;
44+ const content = page . getByTestId ( "popover-content" ) ;
45+ await expect ( content ) . toBeVisible ( ) ;
46+ const box = await content . boundingBox ( ) ;
47+ expect ( box ) . not . toBeNull ( ) ;
48+ const viewport = page . viewportSize ( ) ;
49+ if ( box && viewport ) {
50+ expect ( box . x ) . toBeGreaterThanOrEqual ( 0 ) ;
51+ expect ( box . y ) . toBeGreaterThanOrEqual ( 0 ) ;
52+ expect ( box . x + box . width ) . toBeLessThanOrEqual ( viewport . width + 1 ) ;
53+ expect ( box . y + box . height ) . toBeLessThanOrEqual ( viewport . height + 1 ) ;
54+ }
55+ } ) ;
4156} ) ;
You can’t perform that action at this time.
0 commit comments