11import { test , expect } from '@playwright/test' ;
2+ import { getCSSProperty } from '../src/utils' ;
23
34test ( 'Dark and light theme respect user themes' , async ( { page } ) => {
45 // This document use a custom theme file that change the background color of the title banner
@@ -25,8 +26,15 @@ test('Code block font size did not change and still equals to pre size', async (
2526 await page . goto ( './html/code-font-size.html' ) ;
2627 const code = page . getByRole ( 'code' )
2728 const pre = page . locator ( 'pre' )
28- const preFontSize = await pre . evaluate ( ( element ) =>
29- window . getComputedStyle ( element ) . getPropertyValue ( 'font-size' ) ,
30- ) ;
29+ const preFontSize = await getCSSProperty ( pre , 'font-size' , false ) as string ;
3130 await expect ( code ) . toHaveCSS ( 'font-size' , preFontSize ) ;
32- } ) ;
31+ } ) ;
32+
33+ test ( 'Mainfont can be set to multiple mainfont families' , async ( { page } ) => {
34+ await page . goto ( './html/mainfont/mainfont-1.html' ) ;
35+ expect ( await getCSSProperty ( page . locator ( 'body' ) , '--bs-body-font-family' , false ) ) . toEqual ( 'Creepster, "Cascadia Code", Inter' ) ;
36+ await page . goto ( './html/mainfont/mainfont-2.html' ) ;
37+ expect ( await getCSSProperty ( page . locator ( 'body' ) , '--bs-body-font-family' , false ) ) . toEqual ( 'Creepster, "Cascadia Code", Inter' ) ;
38+ await page . goto ( './html/mainfont/mainfont-3.html' ) ;
39+ expect ( await getCSSProperty ( page . locator ( 'body' ) , '--bs-body-font-family' , false ) ) . toEqual ( 'Creepster, "Cascadia Code", Inter' ) ;
40+ } )
0 commit comments