Skip to content

Commit

Permalink
opt out of tests that require focus/blur events, see phetsims/aqua#134
Browse files Browse the repository at this point in the history
  • Loading branch information
jessegreenberg committed Jun 2, 2023
1 parent ee59049 commit 941a1c4
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions js/accessibility/GrabDragInteractionTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,20 @@ QUnit.test( 'GrabDragInteraction defaults', assert => {

const testDefaultGrabbable = () => {

assert.ok( interaction.grabbable, 'default to grabbable' );
assert.ok( a.tagName.toUpperCase() === 'BUTTON', 'grabbable defaults to button' );
assert.ok( a.ariaRole === null, 'no role for grabbable' );
assert.ok( a.ariaLabel.indexOf( thingString ) >= 0, 'ariaLabel should include thing string for grabbable' );

const aElement = a.pdomInstances[ 0 ].peer.primarySibling;
assert.ok( aElement.tagName === 'BUTTON', 'grabbable defaults to button html element.' );
// GrabDragInteraction requires the page to be active to behave corectly, otherwise focus/blur events do not
// fire. See https://github.com/phetsims/aqua/issues/134.
if ( document.hasFocus() ) {
assert.ok( interaction.grabbable, 'default to grabbable' );
assert.ok( a.tagName.toUpperCase() === 'BUTTON', 'grabbable defaults to button' );
assert.ok( a.ariaRole === null, 'no role for grabbable' );
assert.ok( a.ariaLabel.indexOf( thingString ) >= 0, 'ariaLabel should include thing string for grabbable' );

const aElement = a.pdomInstances[ 0 ].peer.primarySibling;
assert.ok( aElement.tagName === 'BUTTON', 'grabbable defaults to button html element.' );
}
else {
console.warn( 'Cannot complete tests because document does not have focus.' );
}
};

testDefaultGrabbable();
Expand Down

0 comments on commit 941a1c4

Please sign in to comment.