Skip to content

Commit

Permalink
added AccessibilityUtilTests, #715
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph committed Jun 19, 2018
1 parent 0dee0aa commit ef3fa70
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 15 deletions.
45 changes: 45 additions & 0 deletions js/accessibility/AccessibilityUtilTests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Copyright 2017, University of Colorado Boulder

/**
* Accessibility tests
*
* @author Sam Reid (PhET Interactive Simulations)
*/
define( function( require ) {
'use strict';

// modules
var AccessibilityUtil = require( 'SCENERY/accessibility/AccessibilityUtil' );

QUnit.module( 'AccessibilityUtilTests' );


QUnit.test( 'insertElements', function( assert ) {

var div1 = document.createElement( 'div1' );
var div2 = document.createElement( 'div2' );
var div3 = document.createElement( 'div3' );
var div4 = document.createElement( 'div4' );

AccessibilityUtil.insertElements( div1, [ div2, div3, div4 ] );

assert.ok( div1.childNodes.length === 3, 'inserted number of elements');
assert.ok( div1.childNodes[0] === div2, 'inserted div2 order of elements');
assert.ok( div1.childNodes[1] === div3, 'inserted div3 order of elements');
assert.ok( div1.childNodes[2] === div4, 'inserted div4 order of elements');


var div5 = document.createElement( 'div5' );
var div6 = document.createElement( 'div6' );
var div7 = document.createElement( 'div7' );

AccessibilityUtil.insertElements( div1, [div5,div6,div7], div3);
assert.ok( div1.childNodes[0] === div2, 'inserted div2 order of elements');
assert.ok( div1.childNodes[1] === div5, 'inserted div5 order of elements');
assert.ok( div1.childNodes[2] === div6, 'inserted div6 order of elements');
assert.ok( div1.childNodes[3] === div7, 'inserted div7 order of elements');
assert.ok( div1.childNodes[4] === div3, 'inserted div3 order of elements');
assert.ok( div1.childNodes[5] === div4, 'inserted div4 order of elements');
} );

} );
31 changes: 16 additions & 15 deletions js/scenery-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,22 @@ define( function( require ) {

// modules
require( 'SCENERY/accessibility/AccessibilityTests' );
require( 'SCENERY/accessibility/FocusTests' );
require( 'SCENERY/nodes/AlignBoxTests' );
require( 'SCENERY/util/ColorTests' );
require( 'SCENERY/display/DisplayTests' );
require( 'SCENERY/display/FuzzTests' );
require( 'SCENERY/listeners/DragListenerTests' );
require( 'SCENERY/listeners/FireListenerTests' );
require( 'SCENERY/listeners/PressListenerTests' );
require( 'SCENERY/listeners/DragListenerTests' );
require( 'SCENERY/nodes/NodeTests' );
require( 'SCENERY/nodes/ShapeTests' );
require( 'SCENERY/util/FontTests' );
require( 'SCENERY/util/TrailTests' );
require( 'SCENERY/tests/PixelComparisonTests' );
require( 'SCENERY/tests/MiscellaneousTests' );
require( 'SCENERY/accessibility/AccessibilityUtilTests' );
// require( 'SCENERY/accessibility/FocusTests' );
// require( 'SCENERY/nodes/AlignBoxTests' );
// require( 'SCENERY/util/ColorTests' );
// require( 'SCENERY/display/DisplayTests' );
// require( 'SCENERY/display/FuzzTests' );
// require( 'SCENERY/listeners/DragListenerTests' );
// require( 'SCENERY/listeners/FireListenerTests' );
// require( 'SCENERY/listeners/PressListenerTests' );
// require( 'SCENERY/listeners/DragListenerTests' );
// require( 'SCENERY/nodes/NodeTests' );
// require( 'SCENERY/nodes/ShapeTests' );
// require( 'SCENERY/util/FontTests' );
// require( 'SCENERY/util/TrailTests' );
// require( 'SCENERY/tests/PixelComparisonTests' );
// require( 'SCENERY/tests/MiscellaneousTests' );

// add elements to the QUnit fixture for our Scenery-specific tests
// TODO: is this necessary?
Expand Down

0 comments on commit ef3fa70

Please sign in to comment.