Skip to content

Commit

Permalink
add tests, #2
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph committed Oct 22, 2019
1 parent 4952a1d commit 0cace57
Show file tree
Hide file tree
Showing 2 changed files with 133 additions and 0 deletions.
48 changes: 48 additions & 0 deletions js/utterance-queue-test-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// Copyright 2019, University of Colorado Boulder

/*
* IMPORTANT: This file was auto-generated by "grunt generate-config". Please do not modify this directly. Instead
* please modify utterance-queue/package.json to control dependencies.
*
* RequireJS configuration file for the utterance-queue sim.
* Paths are relative to the location of this file.
*/

require.config( {

deps: [ 'utterance-queue-tests' ],

paths: {

// Third-party libs
text: '../../sherpa/lib/text-2.0.12',

// PhET plugins
sound: '../../chipper/js/requirejs-plugins/sound',
image: '../../chipper/js/requirejs-plugins/image',
mipmap: '../../chipper/js/requirejs-plugins/mipmap',
string: '../../chipper/js/requirejs-plugins/string',
ifphetio: '../../chipper/js/requirejs-plugins/ifphetio',

// PhET libs, uppercase names to identify them in require.js imports.
// IMPORTANT: DO NOT modify. This file is auto-generated. See documentation at the top.
AXON: '../../axon/js',
BRAND: '../../brand/' + phet.chipper.brand + '/js',
DOT: '../../dot/js',
JOIST: '../../joist/js',
KITE: '../../kite/js',
PHETCOMMON: '../../phetcommon/js',
PHET_CORE: '../../phet-core/js',
PHET_IO: '../../phet-io/js',
REPOSITORY: '..',
SCENERY: '../../scenery/js',
SCENERY_PHET: '../../scenery-phet/js',
SUN: '../../sun/js',
TAMBO: '../../tambo/js',
TANDEM: '../../tandem/js',
UTTERANCE_QUEUE: '.'
},

// Cache busting is applied by default, but can be disabled via ?cacheBust=false, see initialize-globals.js
urlArgs: phet.chipper.getCacheBustArgs()
} );
85 changes: 85 additions & 0 deletions utterance-queue-tests.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<!DOCTYPE HTML>
<!-- Top-level HTML file for utterance-queue generated by 'grunt generate-development-html' -->
<html>
<head>
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="initial-scale=1,user-scalable=no,maximum-scale=1"/>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="phet-sim-level" content="development">
<link rel="stylesheet" href="../sherpa/lib/qunit-2.4.1.css">
<title>utterance-queue</title>
</head>

<!-- body is only made black for the loading phase so that the splash screen is black -->
<body>
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<!-- a11y - aria-live attribute is used to send alerts and status updates to screen readers, otherwise invisible -->
<div id='aria-live-elements'
style="position: absolute; left: 0px; top: 0px; width: 0px; height: 0px; clip: rect(0px 0px 0px 0px); pointer-events: none;">
<p id="polite-1" aria-live="polite"></p>
<p id="polite-2" aria-live="polite"></p>
<p id="polite-3" aria-live="polite"></p>
<p id="polite-4" aria-live="polite"></p>
</div>

<script type="text/javascript">

// Identify the brand (assume generated brand if not provided with query parameters)
const brandMatch = location.search.match( /brand=([^&]+)/ );
const brand = brandMatch ? decodeURIComponent( brandMatch[ 1 ] ) : 'adapted-from-phet';

// Cache busting is applied by default, but can be disabled via ?cacheBust=false, see initialize-globals.js
const isCacheBustDisabled = /(^|\?|&)cacheBust=false/.test( location.search );
const queryAppend = isCacheBustDisabled ? '' : `?bust=${Date.now()}`;

// Preloads, with more included for phet-io brand
let preloads = [
'../sherpa/lib/jquery-2.1.0.js',
'../sherpa/lib/lodash-4.17.4.js',
'../sherpa/lib/FileSaver-b8054a2.js',
'../sherpa/lib/himalaya-0.2.7.js',
'../sherpa/lib/he-1.1.1.js',
'../assert/js/assert.js',
'../query-string-machine/js/QueryStringMachine.js',
'../chipper/js/initialize-globals.js',
'../phet-core/js/copyWithSortedKeys.js',
'../sherpa/lib/seedrandom-2.4.2.js',
'../sherpa/lib/game-up-camera-1.0.0.js',
'../sherpa/lib/base64-js-1.2.0.js',
'../sherpa/lib/TextEncoderLite-3c9f6f0.js',
'../tandem/js/PhetioIDUtils.js',
'../chipper/js/SimVersion.js',
'../sherpa/lib/qunit-2.4.1.js',
'../aqua/js/qunit-connector.js'
];

if ( brand === 'phet-io' ) {
preloads = preloads.concat( [
'../phet-io/js/phet-io-initialize-globals.js'
] );
}

// Loads a synchronously-executed asynchronously-downloaded script tag, with optional data-main parameter.
// See http://www.html5rocks.com/en/tutorials/speed/script-loading/ for more about script loading. It helps to
// load all of the scripts with this method, so they are treated the same (and placed in the correct execution
// order).
const loadURL = ( preloadURL, main ) => {
const script = document.createElement( 'script' );
if ( typeof main === 'string' ) {
script.setAttribute( 'data-main', main );
}
script.type = 'text/javascript';
script.src = preloadURL + queryAppend;
script.async = false;
document.head.appendChild( script );
};

// Queue all of the preloads to be loaded.
preloads.forEach( loadURL );

loadURL( '../sherpa/lib/require-2.3.6.js', 'js/utterance-queue-test-config.js' );
</script>
</body>
</html>

0 comments on commit 0cace57

Please sign in to comment.