Skip to content

Commit

Permalink
Use boolean with assert.ok, see phetsims/aqua#52
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid committed Oct 10, 2018
1 parent 44feeea commit 8258459
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion js/accessibility/AccessibilityTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -1114,7 +1114,7 @@ define( function( require ) {
assert.ok( testNode.accessibleInstances[ 0 ].peer.primarySibling === document.activeElement, 'browser is focusing testNode' );

testNode.blur();
assert.ok( testNode, 'testNode blurred before being replaced' );
assert.ok( !!testNode, 'testNode blurred before being replaced' );

// replace testNode with f after bluring testNode, neither should have focus after the replacement
a.replaceChild( testNode, f );
Expand Down
16 changes: 8 additions & 8 deletions js/nodes/NodeTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,24 @@ define( function( require ) {

node.addChild( rect );

assert.ok( rect.hitTest( new Vector2( 10, 10 ) ), 'Rectangle intersection' );
assert.ok( rect.hitTest( new Vector2( 90, 10 ) ), 'Rectangle intersection' );
assert.ok( !!rect.hitTest( new Vector2( 10, 10 ) ), 'Rectangle intersection' );
assert.ok( !!rect.hitTest( new Vector2( 90, 10 ) ), 'Rectangle intersection' );
assert.ok( !rect.hitTest( new Vector2( -10, 10 ) ), 'Rectangle no intersection' );

node.touchArea = Shape.rectangle( -50, -50, 100, 100 );

assert.ok( node.hitTest( new Vector2( 10, 10 ) ), 'Node intersection' );
assert.ok( node.hitTest( new Vector2( 90, 10 ) ), 'Node intersection' );
assert.ok( !!node.hitTest( new Vector2( 10, 10 ) ), 'Node intersection' );
assert.ok( !!node.hitTest( new Vector2( 90, 10 ) ), 'Node intersection' );
assert.ok( !node.hitTest( new Vector2( -10, 10 ) ), 'Node no intersection' );

assert.ok( node.trailUnderPointer( fakeTouchPointer( new Vector2( 10, 10 ) ) ), 'Node intersection (isTouch)' );
assert.ok( node.trailUnderPointer( fakeTouchPointer( new Vector2( 90, 10 ) ) ), 'Node intersection (isTouch)' );
assert.ok( node.trailUnderPointer( fakeTouchPointer( new Vector2( -10, 10 ) ) ), 'Node intersection (isTouch)' );
assert.ok( !!node.trailUnderPointer( fakeTouchPointer( new Vector2( 10, 10 ) ) ), 'Node intersection (isTouch)' );
assert.ok( !!node.trailUnderPointer( fakeTouchPointer( new Vector2( 90, 10 ) ) ), 'Node intersection (isTouch)' );
assert.ok( !!node.trailUnderPointer( fakeTouchPointer( new Vector2( -10, 10 ) ) ), 'Node intersection (isTouch)' );

node.clipArea = Shape.rectangle( 0, 0, 50, 50 );

// points outside the clip area shouldn't register as hits
assert.ok( node.trailUnderPointer( fakeTouchPointer( new Vector2( 10, 10 ) ) ), 'Node intersection (isTouch with clipArea)' );
assert.ok( !!node.trailUnderPointer( fakeTouchPointer( new Vector2( 10, 10 ) ) ), 'Node intersection (isTouch with clipArea)' );
assert.ok( !node.trailUnderPointer( fakeTouchPointer( new Vector2( 90, 10 ) ) ), 'Node no intersection (isTouch with clipArea)' );
assert.ok( !node.trailUnderPointer( fakeTouchPointer( new Vector2( -10, 10 ) ) ), 'Node no intersection (isTouch with clipArea)' );
} );
Expand Down

0 comments on commit 8258459

Please sign in to comment.