test: verify Related Stories workflows
This commit is contained in:
8 files changed
+702
-110
No files matched your search
@@ -298,11 +298,32 @@ describe( 'Related Stories progressive controllers', () => {
|
||||
media.change( false );
|
||||
expect( focusAtHide ).toBe( fixture.heading );
|
||||
expect( document.activeElement ).toBe( fixture.heading );
|
||||
expect( fixture.heading.getAttribute( 'tabindex' ) ).toBe( '-1' );
|
||||
document.querySelector( '[data-unrelated]' ).focus();
|
||||
expect( fixture.heading.hasAttribute( 'tabindex' ) ).toBe( false );
|
||||
expect( fixture.controls.hidden ).toBe( true );
|
||||
},
|
||||
);
|
||||
|
||||
test( 'resize repairs focused controls before the media change event arrives', () => {
|
||||
const { initialize } = require( modulePath );
|
||||
const media = createMedia( true );
|
||||
const fixture = installFixture().get( 'one' );
|
||||
initialize( options( media ) );
|
||||
fixture.next.focus();
|
||||
|
||||
media.matches = false;
|
||||
fixture.geometry.clientWidth = fixture.geometry.scrollWidth;
|
||||
window.dispatchEvent( new Event( 'resize' ) );
|
||||
|
||||
expect( document.activeElement ).toBe( fixture.heading );
|
||||
expect( fixture.controls.hidden ).toBe( true );
|
||||
expect( fixture.next.disabled ).toBe( false );
|
||||
expect( fixture.heading.getAttribute( 'tabindex' ) ).toBe( '-1' );
|
||||
document.querySelector( '[data-unrelated]' ).focus();
|
||||
expect( fixture.heading.hasAttribute( 'tabindex' ) ).toBe( false );
|
||||
} );
|
||||
|
||||
test( 'unrelated focus remains unchanged when adaptive controls hide', () => {
|
||||
const { initialize } = require( modulePath );
|
||||
const media = createMedia( true );
|
||||
|
||||
Reference in new issue
Block a user