Skip to content

Commit

Permalink
Add API validation for preferences phetioState, see phetsims/joist#744
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid committed Sep 21, 2022
1 parent 91abe06 commit f104162
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions js/phetioAPIValidation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,13 @@ class PhetioAPIValidation {
}
assert && assert( !phetioObject.phetioReadOnly, 'preferences model and its descendants should be phetioReadOnly: false, key=' + preferencesKey );

// Audio manager, color profile property and localeProperty are supposed to be stateful.
// assert && assert( !phetioObject.phetioState, 'preferences model and its descendants should be phetioState: false, key=' + preferencesKey );
// Audio manager, color profile property and localeProperty are supposed to be stateful. All other preferences
// should be phetioState: false so they are not captured in the state
assert && assert( phetioObject.phetioState ===
( phetioObject.phetioID.endsWith( '.colorProfileProperty' ) ||
phetioObject.phetioID.endsWith( '.audioEnabledProperty' ) ||
phetioObject.phetioID.endsWith( '.localeProperty' ) ),
'most preferences should be phetioState: false, key=' + preferencesKey );
} );
}

Expand Down

0 comments on commit f104162

Please sign in to comment.