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 committed Jul 21, 2020
1 parent af85f2b commit 3cd429c
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

1 comment on commit 3cd429c

@pixelzoom
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.