Skip to content

Commit

Permalink
Add a runtime assertion that phet-io instrumented Checkbox instances …
Browse files Browse the repository at this point in the history
…have a LinkedElement Property, see #914
  • Loading branch information
samreid committed Dec 4, 2024
1 parent 67e4495 commit 4166160
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions js/Checkbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,11 @@ export default class Checkbox extends WidthSizable( Voicing( Node ) ) {
tandemName: 'property'
} );

if ( assert && this.isPhetioInstrumented() ) {
assert && assert( property.isPhetioInstrumented(), 'Property should be instrumented if Checkbox is instrumented' );
assert && assert( options.phetioLinkProperty, 'Property should be linked if Checkbox is instrumented' );
}

// support for binder documentation, stripped out in builds and only runs when ?binder is specified
assert && window.phet?.chipper?.queryParameters?.binder && InstanceRegistry.registerDataURL( 'sun', 'Checkbox', this );

Expand Down

0 comments on commit 4166160

Please sign in to comment.