diff --git a/packages/mdc-chips/chip-set/foundation.ts b/packages/mdc-chips/chip-set/foundation.ts index 019b3a65df3..11a70fb59fe 100644 --- a/packages/mdc-chips/chip-set/foundation.ts +++ b/packages/mdc-chips/chip-set/foundation.ts @@ -110,12 +110,6 @@ export class MDCChipSetFoundation extends MDCFoundation { this.adapter_.removeChipAtIndex(index); const maxIndex = this.adapter_.getChipListCount() - 1; const nextIndex = Math.min(index, maxIndex); - - // Early exit if there are no other chips in the set - if (nextIndex < 0) { - return; - } - this.removeFocusFromChipsExcept_(nextIndex); // After removing a chip, we should focus the trailing action for the next chip. this.adapter_.focusChipTrailingActionAtIndex(nextIndex); diff --git a/test/unit/mdc-chips/mdc-chip-set.foundation.test.js b/test/unit/mdc-chips/mdc-chip-set.foundation.test.js index f312caad500..db74b22a1a4 100644 --- a/test/unit/mdc-chips/mdc-chip-set.foundation.test.js +++ b/test/unit/mdc-chips/mdc-chip-set.foundation.test.js @@ -245,15 +245,6 @@ test('#handleChipRemoval gives focus to the next chip', () => { td.verify(mockAdapter.focusChipTrailingActionAtIndex(1)); }); -test('#handleChipRemoval does not throw error if chip set is left empty', () => { - const {foundation, mockAdapter} = setupTest(); - td.when(mockAdapter.getChipListCount()).thenReturn(0); - td.when(mockAdapter.getIndexOfChipById('chipA')).thenReturn(0); - - foundation.handleChipRemoval('chipA'); - td.verify(mockAdapter.focusChipTrailingActionAtIndex(-1), {times: 0}); -}); - function setupChipNavigationTest(chipIds, isRTL=false) { const {foundation, mockAdapter} = setupTest(); td.when(mockAdapter.getIndexOfChipById(td.matchers.isA(String))).thenDo((id) => {