11import { test , expect , Locator } from '@playwright/test' ;
2- import { asRGB , checkColor , checkFontSizeIdentical , getCSSProperty } from '../src/utils' ;
2+ import { asRGB , checkColor , checkFontSizeIdentical , getCSSProperty , RGBColor } from '../src/utils' ;
33
44async function getRevealMainFontSize ( page : any ) : Promise < number > {
55 return await getCSSProperty ( page . locator ( 'body' ) , "--r-main-font-size" , true ) as number ;
@@ -103,11 +103,15 @@ test('Code font size is correctly set', async ({ page }) => {
103103 ) . toBeCloseTo ( codeBlockFontSize ) ;
104104} ) ;
105105
106- test ( 'Callouts colors can be customized' , async ( { page } ) => {
106+ test ( 'Callouts can be customized using SCSS variables ' , async ( { page } ) => {
107107 await page . goto ( './revealjs/callouts/custom-colors.html' ) ;
108- await checkColor ( page . locator ( 'div.callout-note' ) , 'border-left-color' , asRGB ( 128 , 0 , 128 ) ) ;
109- await checkColor ( page . locator ( 'div.callout-tip' ) , 'border-left-color' , asRGB ( 255 , 255 , 0 ) ) ;
110- await checkColor ( page . locator ( 'div.callout-warning' ) , 'border-left-color' , asRGB ( 173 , 216 , 230 ) ) ;
111- await checkColor ( page . locator ( 'div.callout-important' ) , 'border-left-color' , asRGB ( 128 , 128 , 128 ) ) ;
112- await checkColor ( page . locator ( 'div.callout-caution' ) , 'border-left-color' , asRGB ( 0 , 128 , 0 ) ) ;
108+ async function checkCustom ( loc : Locator , width : string , color : RGBColor ) {
109+ await expect ( loc ) . toHaveCSS ( 'border-left-width' , width ) ;
110+ await checkColor ( loc , 'border-left-color' , color ) ;
111+ }
112+ await checkCustom ( page . locator ( 'div.callout-note' ) , '10px' , asRGB ( 128 , 0 , 128 ) ) ;
113+ await checkCustom ( page . locator ( 'div.callout-tip' ) , '10px' , asRGB ( 255 , 255 , 0 ) ) ;
114+ await checkCustom ( page . locator ( 'div.callout-warning' ) , '10px' , asRGB ( 173 , 216 , 230 ) ) ;
115+ await checkCustom ( page . locator ( 'div.callout-important' ) , '10px' , asRGB ( 128 , 128 , 128 ) ) ;
116+ await checkCustom ( page . locator ( 'div.callout-caution' ) , '10px' , asRGB ( 0 , 128 , 0 ) ) ;
113117} ) ;
0 commit comments