Add validator for SegmentedControlButtonGroup options prop
Description
Let's add a prop validator for options
in SegmentedControlButtonGroup
which was introduced !84803 (merged).
Context
The following discussion from !84803 (merged) should be addressed:
-
@mrincon started a discussion: (+1 comment) Question: Do you want to add a simple validator here? We could confirm:
-
opt
is an object -
opt.value
is one of[String, Number, Boolean]
-
disabled
is boolean or undefined (?)
-
Implementation plan
We can either:
- Implement the
validator()
function inline in the component, unit testing that aconsole.error
message shows up when invalid props are passed. - Create a separate
validateOptionsProp
function which is unit tested on it's own, and assign this tovalidator: validateOptionsProp
(see example).
Edited by Paul Slaughter