@loadsmart/loadsmart-ui 6.0.3 → 6.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -192,6 +192,23 @@ describe('Select', () => {
|
|
|
192
192
|
expect(onBlur).toHaveBeenNthCalledWith(1, new MouseEvent('mousedown'))
|
|
193
193
|
expect(onBlur).toHaveBeenNthCalledWith(2, new KeyboardEvent('keyup'))
|
|
194
194
|
})
|
|
195
|
+
|
|
196
|
+
it('shrinks when an option is selected', async () => {
|
|
197
|
+
setup({})
|
|
198
|
+
|
|
199
|
+
const searchInput = screen.getByLabelText('Select your favorite fruit')
|
|
200
|
+
const searchedFruit = generator.pickone([...FRUITS])
|
|
201
|
+
|
|
202
|
+
fire.change(searchInput, {
|
|
203
|
+
target: { value: searchedFruit.label },
|
|
204
|
+
})
|
|
205
|
+
|
|
206
|
+
expect(selectEvent.isMenuExpanded(searchInput)).toBe(true)
|
|
207
|
+
|
|
208
|
+
await selectEvent.select(searchedFruit.label, searchInput)
|
|
209
|
+
|
|
210
|
+
expect(selectEvent.isMenuExpanded(searchInput)).toBe(false)
|
|
211
|
+
})
|
|
195
212
|
})
|
|
196
213
|
|
|
197
214
|
describe('Single selection', () => {
|
|
@@ -383,8 +383,10 @@ function useSelect(props: SelectProps): useSelectReturn {
|
|
|
383
383
|
'aria-selected': checked,
|
|
384
384
|
id: String(value),
|
|
385
385
|
onClick() {
|
|
386
|
+
setQueryTyped(false)
|
|
387
|
+
|
|
386
388
|
if (!multiple) {
|
|
387
|
-
|
|
389
|
+
setQueryTyped(false)
|
|
388
390
|
}
|
|
389
391
|
toggleOption(option)
|
|
390
392
|
|