1- import type { Page } from "@playwright/test"
1+ import type { Locator , Page } from "@playwright/test"
22import { expect , sourceURL , story } from "../../stories/playwright/story"
33
44const png = Buffer . from (
@@ -318,8 +318,9 @@ story("shows a stable GitHub mark without changing link text or other sites", as
318318 await expect ( github ) . toHaveAttribute ( "href" , "https://github.com/anomalyco/opencode/pull/540" )
319319 await expect ( github ) . toHaveText ( "#540" )
320320 const mark = github . locator ( ".markdown-link-favicon[data-github]" )
321- expect ( await mark . evaluate ( ( icon ) => getComputedStyle ( icon , "::before" ) . width ) ) . toBe ( "14px" )
322- expect ( await mark . evaluate ( ( icon ) => getComputedStyle ( icon , "::before" ) . maskImage ) ) . toContain ( "data:image/svg+xml" )
321+ const glyph = mark . locator ( ".markdown-link-favicon-glyph" )
322+ expect ( await glyph . evaluate ( ( icon ) => getComputedStyle ( icon ) . width ) ) . toBe ( "14px" )
323+ expect ( await glyph . evaluate ( ( icon ) => getComputedStyle ( icon ) . maskImage ) ) . toContain ( "data:image/svg+xml" )
323324 await expect ( mark . locator ( "img" ) ) . toHaveCount ( 0 )
324325 await expect ( markdown . getByRole ( "link" , { name : "GitHub" } ) . locator ( ".markdown-link-favicon[data-github]" ) ) . toHaveCount (
325326 1 ,
@@ -360,15 +361,18 @@ story("keeps favicon space stable across loading and failure without fetching pr
360361 await expect ( markdown ) . toHaveAttribute ( "data-markdown-ready" , "" )
361362 const docs = markdown . getByRole ( "link" , { name : "docs" } )
362363 const image = docs . locator ( ".markdown-link-favicon img" )
364+ const globe = ( link : Locator ) => link . locator ( ".markdown-link-favicon-glyph" )
363365 await expect . poll ( ( ) => requested . some ( ( url ) => url . includes ( "developer.mozilla.org" ) ) ) . toBe ( true )
364366 await expect ( image ) . toHaveCSS ( "opacity" , "0" )
367+ await expect ( globe ( docs ) ) . toBeVisible ( )
365368 expect ( ( await docs . locator ( ".markdown-link-favicon" ) . boundingBox ( ) ) ?. width ) . toBe ( 14 )
366369 // A late web font swap also changes the link width; measure after fonts settle.
367370 await page . evaluate ( ( ) => document . fonts . ready . then ( ( ) => undefined ) )
368371 const width = await docs . evaluate ( ( link ) => link . getBoundingClientRect ( ) . width )
369372 release ( )
370373 await expect ( image ) . toHaveAttribute ( "data-loaded" , "" )
371374 await expect ( image ) . toHaveCSS ( "opacity" , "1" )
375+ await expect ( globe ( docs ) ) . toHaveCount ( 0 )
372376 await expect ( image ) . not . toHaveAttribute ( "role" , "button" )
373377 expect ( await image . evaluate ( ( favicon ) => favicon . onclick ) ) . toBeNull ( )
374378 expect ( await docs . evaluate ( ( link ) => link . getBoundingClientRect ( ) . width ) ) . toBe ( width )
@@ -384,6 +388,7 @@ story("keeps favicon space stable across loading and failure without fetching pr
384388 await expect (
385389 markdown . getByRole ( "link" , { name : "missing" } ) . locator ( ".markdown-link-favicon img" ) ,
386390 ) . not . toHaveAttribute ( "data-loaded" , "" )
391+ await expect ( globe ( markdown . getByRole ( "link" , { name : "missing" } ) ) ) . toBeVisible ( )
387392 await expect ( markdown . getByRole ( "link" , { name : "private" } ) . locator ( ".markdown-link-favicon img" ) ) . toHaveCount ( 0 )
388393 await expect ( markdown . getByRole ( "link" , { name : "GitHub" } ) . locator ( ".markdown-link-favicon img" ) ) . toHaveCount ( 0 )
389394 expect ( requested ) . toHaveLength ( 2 )
0 commit comments