@@ -19,11 +19,33 @@ async function expectVisualContract(page, name) {
1919 expect ( `${ JSON . stringify ( contract , null , 2 ) } \n` ) . toMatchSnapshot ( name ) ;
2020}
2121
22+ async function expectNativeDivider ( page ) {
23+ const divider = await page . locator ( PANEL_SELECTOR ) . evaluate ( ( panel ) => {
24+ const panelRect = panel . getBoundingClientRect ( ) ;
25+ const ladder = panel . querySelector ( '[data-panel-group="ladder"]' ) ;
26+ const ladderRect = ladder . getBoundingClientRect ( ) ;
27+ const style = getComputedStyle ( ladder ) ;
28+ return {
29+ leftInset : ladderRect . left - panelRect . left ,
30+ rightInset : panelRect . right - ladderRect . right ,
31+ borderTopWidth : style . borderTopWidth ,
32+ borderTopColor : style . borderTopColor ,
33+ } ;
34+ } ) ;
35+ expect ( divider ) . toEqual ( {
36+ leftInset : 1 ,
37+ rightInset : 1 ,
38+ borderTopWidth : '1px' ,
39+ borderTopColor : 'rgb(237, 237, 237)' ,
40+ } ) ;
41+ }
42+
2243test ( 'open panel matches the fixed visual contract' , async ( { page } ) => {
2344 await openUserscriptScenario ( page , createCancelScenario ( {
2445 ui : { tradeMode : 'OPEN' } ,
2546 } ) ) ;
2647 await expectPrecisionReady ( page ) ;
48+ await expectNativeDivider ( page ) ;
2749 await expectVisualContract ( page , 'open-fixed.visual.json' ) ;
2850} ) ;
2951
@@ -36,5 +58,6 @@ test('close panel matches the disabled-state visual contract', async ({ page })
3658 await expect ( panel . getByRole ( 'radio' , { name : '平多' } ) ) . toBeEnabled ( ) ;
3759 await expect ( panel . getByRole ( 'radio' , { name : '平空' } ) ) . toBeDisabled ( ) ;
3860 await expectPrecisionReady ( page ) ;
61+ await expectNativeDivider ( page ) ;
3962 await expectVisualContract ( page , 'close-fixed.visual.json' ) ;
4063} ) ;
0 commit comments