Skip to content

Commit

Permalink
Fallback to nominal screens when there is an error in screens query p…
Browse files Browse the repository at this point in the history
…arameter, see phetsims/ph-scale#171
  • Loading branch information
samreid authored and pixelzoom committed Jul 29, 2020
1 parent f8a7213 commit b70be9b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion js/selectScreens.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ const selectScreens = ( allSimScreens,
// truthiness before attempting to use it. For `screens` documentation, see the schema at
// phet.chipper.queryParameters.screens in initialize-globals.js.
if ( screensQueryParameterProvided && screensQueryParameter ) {

let allScreensValid = true;
screensQueryParameter.forEach( userIndex => {
const screenIndex = userIndex - 1; // screens query parameter is 1-based

Expand All @@ -64,12 +66,16 @@ const selectScreens = ( allSimScreens,

// handle gracefully when running without ?ea and set selectedSimScreens to default values, see https://github.com/phetsims/joist/issues/599
QueryStringMachine.addWarning( 'screens', userIndex, errorMessage );
selectedSimScreens = allSimScreens;

// to support expected failures in selectScreensTests.js unit tests
assert && assert( false, errorMessage );
allScreensValid = false;
}
} );

if ( !allScreensValid ) {
selectedSimScreens = allSimScreens;
}
}
else {
selectedSimScreens = allSimScreens;
Expand Down

0 comments on commit b70be9b

Please sign in to comment.