File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed
chartlets.js/packages/lib/src/plugins/mui Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -105,6 +105,47 @@ describe("Select", () => {
105105 } ) ;
106106 } ) ;
107107
108+ it ( "should fire 'value' property with an array of multiple values" , ( ) => {
109+ const { recordedEvents, onChange } = createChangeHandler ( ) ;
110+ render (
111+ < Select
112+ id = "sel"
113+ type = { "Select" }
114+ label = { "Colors" }
115+ options = { [ 10 , 11 , 12 ] }
116+ value = { [ ] }
117+ onChange = { onChange }
118+ multiple = { true }
119+ /> ,
120+ ) ;
121+ // open the Select component's list box
122+ // note, we must use "mouseDown" as "click" doesn't work
123+ fireEvent . mouseDown ( screen . getByRole ( "combobox" ) ) ;
124+ // click item in the Select component's list box
125+ const listBox = within ( screen . getByRole ( "listbox" ) ) ;
126+ fireEvent . click ( listBox . getByText ( / 1 1 / i) ) ;
127+ fireEvent . click ( listBox . getByText ( / 1 2 / i) ) ;
128+ expect ( recordedEvents . length ) . toBe ( 2 ) ;
129+ expect ( recordedEvents [ 1 ] ) . toEqual ( {
130+ componentType : "Select" ,
131+ id : "sel" ,
132+ property : "value" ,
133+ value : [ 12 ] ,
134+ } ) ;
135+ expect ( recordedEvents ) . toEqual ( [ {
136+ componentType : "Select" ,
137+ id : "sel" ,
138+ property : "value" ,
139+ value : [ 11 ] ,
140+ } ,
141+ {
142+ componentType : "Select" ,
143+ id : "sel" ,
144+ property : "value" ,
145+ value : [ 12 ] ,
146+ } ] ) ;
147+ } ) ;
148+
108149 it ( "should fire 'value' property with object options" , ( ) => {
109150 const { recordedEvents, onChange } = createChangeHandler ( ) ;
110151 render (
You can’t perform that action at this time.
0 commit comments