From b70be9b93cca28d17afb6af473960de1027dff1a Mon Sep 17 00:00:00 2001 From: samreid Date: Mon, 20 Jul 2020 22:22:20 -0600 Subject: [PATCH] Fallback to nominal screens when there is an error in screens query parameter, see https://github.com/phetsims/ph-scale/issues/171 --- js/selectScreens.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/js/selectScreens.js b/js/selectScreens.js index e19e69e6..22a6a56e 100644 --- a/js/selectScreens.js +++ b/js/selectScreens.js @@ -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 @@ -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;