@gitlab/ui 37.9.0 → 37.9.1

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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [37.9.1](https://gitlab.com/gitlab-org/gitlab-ui/compare/v37.9.0...v37.9.1) (2022-03-16)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **GlFilteredSearch:** Keep active state on backspace on first token ([bd241df](https://gitlab.com/gitlab-org/gitlab-ui/commit/bd241dfbbd87064c10a67f0a0857b54542362605))
7
+
1
8
  # [37.9.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v37.8.0...v37.9.0) (2022-03-15)
2
9
 
3
10
 
@@ -241,8 +241,8 @@ var script = {
241
241
  // possible, make sure no token is active.
242
242
 
243
243
  if (intent === INTENT_ACTIVATE_PREVIOUS) {
244
- // If there is a previous token, activate it; else, deactivate all tokens
245
- this.activeTokenIdx = idx > 0 ? idx - 1 : null;
244
+ // If there is a previous token, activate it; else, activate the first token
245
+ this.activeTokenIdx = Math.max(idx - 1, 0);
246
246
  } else if (idx < this.activeTokenIdx) {
247
247
  // Preserve the active token's active status (it shifted down one index)
248
248
  this.activeTokenIdx -= 1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "37.9.0",
3
+ "version": "37.9.1",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -211,7 +211,7 @@ describe('Filtered search', () => {
211
211
  expect(wrapper.findComponent(FakeToken).props('active')).toBe(true);
212
212
  });
213
213
 
214
- it('makes no token active if user intends it on first token destruction', async () => {
214
+ it('keeps first token active on first token destruction with backspace', async () => {
215
215
  createComponent({
216
216
  value: ['foo', { type: 'faketoken', value: '' }],
217
217
  });
@@ -228,7 +228,7 @@ describe('Filtered search', () => {
228
228
 
229
229
  await nextTick();
230
230
 
231
- expect(wrapper.findComponent(FakeToken).props('active')).toBe(false);
231
+ expect(wrapper.findComponent(FakeToken).props('active')).toBe(true);
232
232
  });
233
233
 
234
234
  it('keeps active token active if later one destroyed', async () => {
@@ -222,8 +222,8 @@ export default {
222
222
  // active state for the token that was active at the time. If that's not
223
223
  // possible, make sure no token is active.
224
224
  if (intent === INTENT_ACTIVATE_PREVIOUS) {
225
- // If there is a previous token, activate it; else, deactivate all tokens
226
- this.activeTokenIdx = idx > 0 ? idx - 1 : null;
225
+ // If there is a previous token, activate it; else, activate the first token
226
+ this.activeTokenIdx = Math.max(idx - 1, 0);
227
227
  } else if (idx < this.activeTokenIdx) {
228
228
  // Preserve the active token's active status (it shifted down one index)
229
229
  this.activeTokenIdx -= 1;