@@ -139,6 +139,32 @@ test.describe('Dev Overlay', () => {
139
139
await expect ( auditWindow . locator ( 'astro-dev-toolbar-icon[icon=check-circle]' ) ) . toBeVisible ( ) ;
140
140
} ) ;
141
141
142
+ test ( 'adjusts tooltip position if off-screen' , async ( { page, astro } ) => {
143
+ await page . goto ( astro . resolveUrl ( '/tooltip-position' ) ) ;
144
+
145
+ const overlay = page . locator ( 'astro-dev-toolbar' ) ;
146
+ const pluginButton = overlay . locator ( 'button[data-plugin-id="astro:audit"]' ) ;
147
+ await pluginButton . click ( ) ;
148
+
149
+ const auditCanvas = overlay . locator (
150
+ 'astro-dev-toolbar-plugin-canvas[data-plugin-id="astro:audit"]'
151
+ ) ;
152
+ const auditHighlights = auditCanvas . locator ( 'astro-dev-toolbar-highlight' ) ;
153
+ for ( const highlight of await auditHighlights . all ( ) ) {
154
+ await expect ( highlight ) . toBeVisible ( ) ;
155
+ await highlight . hover ( ) ;
156
+ const tooltip = highlight . locator ( 'astro-dev-toolbar-tooltip' ) ;
157
+ await expect ( tooltip ) . toBeVisible ( ) ;
158
+ const tooltipBox = await tooltip . boundingBox ( ) ;
159
+ const { clientWidth, clientHeight } = await page . evaluate ( ( ) => ( {
160
+ clientWidth : document . documentElement . clientWidth ,
161
+ clientHeight : document . documentElement . clientHeight ,
162
+ } ) ) ;
163
+ expect ( tooltipBox . x + tooltipBox . width ) . toBeLessThan ( clientWidth ) ;
164
+ expect ( tooltipBox . y + tooltipBox . height ) . toBeLessThan ( clientHeight ) ;
165
+ }
166
+ } ) ;
167
+
142
168
test ( 'can open Settings plugin' , async ( { page, astro } ) => {
143
169
await page . goto ( astro . resolveUrl ( '/' ) ) ;
144
170
0 commit comments