@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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loadsmart/loadsmart-ui",
3
- "version": "6.0.3",
3
+ "version": "6.0.5",
4
4
  "description": "Miranda UI, a React UI library",
5
5
  "main": "dist",
6
6
  "files": [
@@ -387,6 +387,7 @@ const StyledLoadingDots = styled(LoadingDots).attrs({
387
387
  role: 'presentation',
388
388
  })`
389
389
  position: absolute;
390
+ left: 0;
390
391
 
391
392
  display: flex;
392
393
  align-items: center;
@@ -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
- setQuery(checked ? '' : label)
389
+ setQueryTyped(false)
388
390
  }
389
391
  toggleOption(option)
390
392