Skip to content

Commit

Permalink
remove hard coded aria-live elements, phetsims/utterance-queue#8
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph committed Nov 20, 2019
1 parent 4ec7ae2 commit 8fb86e6
Showing 1 changed file with 51 additions and 55 deletions.
106 changes: 51 additions & 55 deletions dot-tests.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,76 +7,72 @@
<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">
<link rel="stylesheet" href="../sherpa/lib/qunit-2.4.1.css">
<title>dot</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">
( function() {

// Identify the brand (assume generated brand if not provided with query parameters)
var brandMatch = location.search.match( /brand=([^&]+)/ );
var brand = brandMatch ? decodeURIComponent( brandMatch[ 1 ] ) : 'adapted-from-phet';
// 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';

// Preloads, with more included for phet-io brand
var 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',
'../sherpa/lib/qunit-2.4.1.js',
'../aqua/js/qunit-connector.js'
];
// 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()}`;

if ( brand === 'phet-io' ) {
preloads = preloads.concat( [
'../phet-io/js/phet-io-initialize-globals.js'
] );
}
// Preloads, with more included for phet-io brand
let preloads = [
'../phet-core/js/phet-polyfill.js',
'../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).
function loadURL( preloadURL, main ) {
var script = document.createElement( 'script' );
if ( typeof main === 'string' ) {
script.setAttribute( 'data-main', main );
}
script.type = 'text/javascript';
script.src = preloadURL;
script.async = false;
document.head.appendChild( script );
// 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 );
// Queue all of the preloads to be loaded.
preloads.forEach( loadURL );

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

0 comments on commit 8fb86e6

Please sign in to comment.