fix: restore Related Stories resize focus
This commit is contained in:
5 files changed
+24
-37
No files matched your search
@@ -602,9 +602,8 @@ for ( const buttonName of [ 'Previous stories', 'Next stories' ] ) {
|
||||
await page.setViewportSize( { width: 900, height: 900 } );
|
||||
await page.goto( '/long-title-night-writing-fixture/' );
|
||||
const section = page.locator( '#related-stories-3-adaptive .chrnx-related-posts' );
|
||||
const heading = section.getByRole( 'heading', {
|
||||
name: 'Related stories',
|
||||
} );
|
||||
const firstCardLink = section.locator( '.chrnx-related-card__link' ).first();
|
||||
const controls = section.locator( '.chrnx-related-posts__controls' );
|
||||
if ( buttonName === 'Previous stories' ) {
|
||||
await section.getByRole( 'button', { name: 'Next stories' } ).click();
|
||||
await expect( section.getByRole( 'button', { name: 'Previous stories' } ) ).toBeEnabled();
|
||||
@@ -613,8 +612,13 @@ for ( const buttonName of [ 'Previous stories', 'Next stories' ] ) {
|
||||
await button.focus();
|
||||
await expect( button ).toBeFocused();
|
||||
await page.setViewportSize( { width: 901, height: 900 } );
|
||||
await expect( heading ).toBeFocused();
|
||||
await expect( section.locator( '.chrnx-related-posts__controls' ) ).toBeHidden();
|
||||
await expect( firstCardLink ).toBeFocused();
|
||||
await expect( controls ).toBeHidden();
|
||||
expect(
|
||||
await controls.evaluate( ( element ) =>
|
||||
element.contains( element.ownerDocument.activeElement ),
|
||||
),
|
||||
).toBe( false );
|
||||
} );
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user