Skip to content

Commit

Permalink
PatternStringProperty requires PhET-iO instrumentation, phetsims/stud…
Browse files Browse the repository at this point in the history
…io#304

Signed-off-by: Michael Kauzmann <[email protected]>
  • Loading branch information
zepumph committed Jun 2, 2023
1 parent e920a98 commit ee59049
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 20 deletions.
3 changes: 2 additions & 1 deletion js/ComboBoxDisplay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import Property from '../../axon/js/Property.js';
import TReadOnlyProperty from '../../axon/js/TReadOnlyProperty.js';
import StringProperty from '../../axon/js/StringProperty.js';
import PatternStringProperty from '../../axon/js/PatternStringProperty.js';
import Tandem from '../../tandem/js/Tandem.js';

// constants
const DEFAULT_FONT = new PhetFont( 14 );
Expand Down Expand Up @@ -97,7 +98,7 @@ export default class ComboBoxDisplay<T> extends ComboBox<T> {
const unitsProperty = ( typeof item.units === 'string' ) ? new StringProperty( item.units ) : item.units;
const valuePatternStringProperty = new PatternStringProperty( SceneryPhetStrings.comboBoxDisplay.valueUnitsStringProperty, {
units: unitsProperty
} );
}, { tandem: Tandem.OPT_OUT } );
valuePatternStringProperties.push( valuePatternStringProperty );

const itemNode = new NumberDisplay( item.numberProperty, item.range,
Expand Down
3 changes: 2 additions & 1 deletion js/keyboard/help/ComboBoxKeyboardHelpSection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import TextKeyNode from '../TextKeyNode.js';
import KeyboardHelpIconFactory from './KeyboardHelpIconFactory.js';
import KeyboardHelpSection, { KeyboardHelpSectionOptions } from './KeyboardHelpSection.js';
import KeyboardHelpSectionRow from './KeyboardHelpSectionRow.js';
import Tandem from '../../../../tandem/js/Tandem.js';

type SelfOptions = {

Expand Down Expand Up @@ -65,7 +66,7 @@ export default class ComboBoxKeyboardHelpSection extends KeyboardHelpSection {
providedStringProperty, {
thingPlural: thingAsLowerCasePluralStringProperty,
thingSingular: thingAsLowerCaseSingularStringProperty
} );
}, { tandem: Tandem.OPT_OUT } );
ourPatternStringsToDispose.push( patternStringProperty );
return patternStringProperty;
};
Expand Down
7 changes: 4 additions & 3 deletions js/keyboard/help/GrabReleaseKeyboardHelpSection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import TextKeyNode from '../TextKeyNode.js';
import KeyboardHelpIconFactory from './KeyboardHelpIconFactory.js';
import KeyboardHelpSection, { KeyboardHelpSectionOptions } from './KeyboardHelpSection.js';
import KeyboardHelpSectionRow from './KeyboardHelpSectionRow.js';
import Tandem from '../../../../tandem/js/Tandem.js';

type GrabReleaseKeyboardHelpSectionOptions = StrictOmit<KeyboardHelpSectionOptions, 'a11yContentTagName'>;

Expand All @@ -38,17 +39,17 @@ export default class GrabReleaseKeyboardHelpSection extends KeyboardHelpSection
// the visible heading string
const headingStringProperty = new PatternStringProperty( SceneryPhetStrings.keyboardHelpDialog.grabOrReleaseHeadingPatternStringProperty, {
thing: thingAsTitle
} );
}, { tandem: Tandem.OPT_OUT } );

// the visible label string
const labelStringProperty = new PatternStringProperty( SceneryPhetStrings.keyboardHelpDialog.grabOrReleaseLabelPatternStringProperty, {
thing: thingAsLowerCase
} );
}, { tandem: Tandem.OPT_OUT } );

// the string for the PDOM
const descriptionStringProperty = new PatternStringProperty( SceneryPhetStrings.a11y.keyboardHelpDialog.grabOrReleaseDescriptionPatternStringProperty, {
thing: thingAsLowerCase
} );
}, { tandem: Tandem.OPT_OUT } );

const spaceKeyNode = TextKeyNode.space();
const enterKeyNode = TextKeyNode.enter();
Expand Down
29 changes: 15 additions & 14 deletions js/keyboard/help/SliderControlsKeyboardHelpSection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import TextKeyNode from '../TextKeyNode.js';
import KeyboardHelpIconFactory from './KeyboardHelpIconFactory.js';
import KeyboardHelpSection, { KeyboardHelpSectionOptions } from './KeyboardHelpSection.js';
import KeyboardHelpSectionRow from './KeyboardHelpSectionRow.js';
import Tandem from '../../../../tandem/js/Tandem.js';

// Configurations of arrow keys that can be displayed for 'Move between items in a group'
class ArrowKeyIconDisplay extends EnumerationValue {
Expand Down Expand Up @@ -69,13 +70,13 @@ export default class SliderControlsKeyboardHelpSection extends KeyboardHelpSecti
const keyboardHelpDialogVerbSliderStringProperty = new PatternStringProperty( SceneryPhetStrings.keyboardHelpDialog.verbSliderPatternStringProperty, {
verb: options.verbStringProperty,
slider: options.sliderStringProperty
} );
}, { tandem: Tandem.OPT_OUT } );
const keyboardHelpDialogVerbInSmallerStepsStringProperty = new PatternStringProperty( SceneryPhetStrings.keyboardHelpDialog.verbInSmallerStepsPatternStringProperty, {
verb: options.verbStringProperty
} );
}, { tandem: Tandem.OPT_OUT } );
const keyboardHelpDialogVerbInLargerStepsStringProperty = new PatternStringProperty( SceneryPhetStrings.keyboardHelpDialog.verbInLargerStepsPatternStringProperty, {
verb: options.verbStringProperty
} );
}, { tandem: Tandem.OPT_OUT } );

const keysStringProperty =
( options.arrowKeyIconDisplay === ArrowKeyIconDisplay.LEFT_RIGHT ) ? SceneryPhetStrings.a11y.keyboardHelpDialog.slider.leftRightArrowKeysStringProperty :
Expand All @@ -84,42 +85,42 @@ export default class SliderControlsKeyboardHelpSection extends KeyboardHelpSecti
new PatternStringProperty( SceneryPhetStrings.a11y.keyboardHelpDialog.slider.orKeysPatternStringProperty, {
leftRight: SceneryPhetStrings.a11y.keyboardHelpDialog.slider.leftRightArrowKeysStringProperty,
upDown: SceneryPhetStrings.a11y.keyboardHelpDialog.slider.upDownArrowKeysStringProperty
} ) : null;
}, { tandem: Tandem.OPT_OUT } ) : null;
assert && assert( keysStringProperty );
const keyboardHelpDialogDefaultStepsStringProperty = new PatternStringProperty( SceneryPhetStrings.a11y.keyboardHelpDialog.slider.defaultStepsDescriptionPatternStringProperty, {
verb: options.verbStringProperty,
slider: options.sliderStringProperty,
keys: keysStringProperty
} );
keys: keysStringProperty!
}, { tandem: Tandem.OPT_OUT } );

const shiftKeysStringProperty =
( options.arrowKeyIconDisplay === ArrowKeyIconDisplay.LEFT_RIGHT ) ? SceneryPhetStrings.a11y.keyboardHelpDialog.slider.shiftLeftRightArrowKeysStringProperty :
( options.arrowKeyIconDisplay === ArrowKeyIconDisplay.UP_DOWN ) ? SceneryPhetStrings.a11y.keyboardHelpDialog.slider.shiftUpDownArrowKeysStringProperty :
( options.arrowKeyIconDisplay === ArrowKeyIconDisplay.BOTH ) ? new PatternStringProperty( SceneryPhetStrings.a11y.keyboardHelpDialog.slider.orKeysPatternStringProperty, {
leftRight: SceneryPhetStrings.a11y.keyboardHelpDialog.slider.shiftLeftRightArrowKeysStringProperty,
upDown: SceneryPhetStrings.a11y.keyboardHelpDialog.slider.shiftUpDownArrowKeysStringProperty
} ) : null;
}, { tandem: Tandem.OPT_OUT } ) : null;
assert && assert( shiftKeysStringProperty );
const keyboardHelpDialogSmallerStepsStringProperty = new PatternStringProperty( SceneryPhetStrings.a11y.keyboardHelpDialog.slider.smallerStepsDescriptionPatternStringProperty, {
verb: options.verbStringProperty,
keys: shiftKeysStringProperty
} );
keys: shiftKeysStringProperty!
}, { tandem: Tandem.OPT_OUT } );
const keyboardHelpDialogLargerStepsStringProperty = new PatternStringProperty( SceneryPhetStrings.a11y.keyboardHelpDialog.slider.largerStepsDescriptionPatternStringProperty, {
verb: options.verbStringProperty
} );
}, { tandem: Tandem.OPT_OUT } );

const jumpToMinimumStringProperty = new PatternStringProperty( SceneryPhetStrings.keyboardHelpDialog.jumpToMinimumPatternStringProperty, {
minimum: options.minimumStringProperty
} );
}, { tandem: Tandem.OPT_OUT } );
const jumpToMaximumStringProperty = new PatternStringProperty( SceneryPhetStrings.keyboardHelpDialog.jumpToMaximumPatternStringProperty, {
maximum: options.maximumStringProperty
} );
}, { tandem: Tandem.OPT_OUT } );
const jumpToMinimumDescriptionStringProperty = new PatternStringProperty( SceneryPhetStrings.a11y.keyboardHelpDialog.slider.jumpToMinimumDescriptionPatternStringProperty, {
minimum: options.minimumStringProperty
} );
}, { tandem: Tandem.OPT_OUT } );
const jumpToMaximumDescriptionStringProperty = new PatternStringProperty( SceneryPhetStrings.a11y.keyboardHelpDialog.slider.jumpToMaximumDescriptionPatternStringProperty, {
maximum: options.maximumStringProperty
} );
}, { tandem: Tandem.OPT_OUT } );

// 'Move sliders' content

Expand Down
3 changes: 2 additions & 1 deletion js/keypad/KeypadDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import optionize, { combineOptions } from '../../../phet-core/js/optionize.js';
import TReadOnlyProperty from '../../../axon/js/TReadOnlyProperty.js';
import SceneryPhetStrings from '../SceneryPhetStrings.js';
import StrictOmit from '../../../phet-core/js/types/StrictOmit.js';
import Tandem from '../../../tandem/js/Tandem.js';

type SelfOptions = {
// Font used for all Text instances within the Dialog.
Expand Down Expand Up @@ -212,7 +213,7 @@ class KeypadDialog extends Dialog {
this.rangeStringProperty = new PatternStringProperty( patternStringProperty, {
min: valueRange.min,
max: valueRange.max
} );
}, { tandem: Tandem.OPT_OUT } );
this.rangeText.mutate( {
stringProperty: this.rangeStringProperty
} );
Expand Down

1 comment on commit ee59049

@zepumph
Copy link
Member Author

@zepumph zepumph commented on ee59049 Jun 2, 2023

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.