@@ -154,20 +154,18 @@ describe('Multiselect with "select all" control', () => {
154154 wrapper . openDropdown ( ) ;
155155 const dropdown = wrapper . findDropdown ( ) ;
156156 const optionsContainer = dropdown . findOptionsContainer ( ) ! ;
157- // When opening the dropdown no option gets highlighted if none is selected. Move one position down to highlight the "Select all" control.
158- optionsContainer . keydown ( KeyCode . down ) ;
157+ // When opening the dropdown the first option ("Select all") gets highlighted if none is selected.
159158 optionsContainer . keydown ( KeyCode . space ) ;
160159 expect ( dropdown . findOptionByValue ( '1' ) ) . toBeNull ( ) ;
161160 } ) ;
162161
163- describe . each ( [ false , true ] ) ( 'virtuaScroll =%s' , virtualScroll => {
162+ describe . each ( [ false , true ] ) ( 'virtualScroll =%s' , virtualScroll => {
164163 test ( 'selects all options when none are selected' , ( ) => {
165164 const onChange = jest . fn ( ) ;
166165 const wrapper = renderMultiselectWithSelectAll ( { onChange, virtualScroll } ) ;
167166 wrapper . openDropdown ( ) ;
168167 const optionsContainer = wrapper . findDropdown ( ) . findOptionsContainer ( ) ! ;
169- // When opening the dropdown no option gets highlighted if none is selected. Move one position down to highlight the "Select all" control.
170- optionsContainer . keydown ( KeyCode . down ) ;
168+ // When opening the dropdown the first option ("Select all") gets highlighted if none is selected.
171169 optionsContainer . keydown ( KeyCode . space ) ;
172170 expect ( onChange ) . toHaveBeenCalledWith (
173171 expect . objectContaining ( { detail : { selectedOptions : optionsWithoutGroups } } )
@@ -187,14 +185,14 @@ describe('Multiselect with "select all" control', () => {
187185 const wrapper = createWrapper ( container ) . findMultiselect ( ) ! ;
188186 wrapper . openDropdown ( ) ;
189187 const selectAll = wrapper . findDropdown ( ) . findSelectAll ( ) ! ;
190- expect ( selectAll . getElement ( ) . textContent ) . toBe ( 'Custom Select all text' ) ;
188+ expect ( selectAll . getElement ( ) ) . toHaveTextContent ( 'Custom Select all text' ) ;
191189 } ) ;
192190
193191 test ( 'uses i18nStrings.selectAllText from i18nStrings prop' , ( ) => {
194192 const wrapper = renderMultiselectWithSelectAll ( { i18nStrings : { selectAllText : 'Custom Select all text' } } ) ;
195193 wrapper . openDropdown ( ) ;
196194 const selectAll = wrapper . findDropdown ( ) . findSelectAll ( ) ! ;
197- expect ( selectAll . getElement ( ) . textContent ) . toBe ( 'Custom Select all text' ) ;
195+ expect ( selectAll . getElement ( ) ) . toHaveTextContent ( 'Custom Select all text' ) ;
198196 } ) ;
199197
200198 test ( 'uses i18nStrings.selectAllText from i18nStrings prop when both i18n provider and i18nStrings prop are provided ' , ( ) => {
@@ -214,7 +212,7 @@ describe('Multiselect with "select all" control', () => {
214212 const wrapper = createWrapper ( container ) . findMultiselect ( ) ! ;
215213 wrapper . openDropdown ( ) ;
216214 const selectAll = wrapper . findDropdown ( ) . findSelectAll ( ) ! ;
217- expect ( selectAll . getElement ( ) . textContent ) . toBe ( 'Custom Select all text from i18nStrings' ) ;
215+ expect ( selectAll . getElement ( ) ) . toHaveTextContent ( 'Custom Select all text from i18nStrings' ) ;
218216 } ) ;
219217 } ) ;
220218
0 commit comments