Skip to content

Commit b4c595f

Browse files
committed
test: add test verifying Esc only clears selectedItems when closed
1 parent 4f81f5b commit b4c595f

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

packages/multi-select-combo-box/test/basic.test.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { expect } from '@vaadin/chai-plugins';
22
import { resetMouse, sendKeys, sendMouse } from '@vaadin/test-runner-commands';
3-
import { fire, fixtureSync, nextFrame, nextRender } from '@vaadin/testing-helpers';
3+
import { fire, fixtureSync, nextFrame, nextRender, oneEvent } from '@vaadin/testing-helpers';
44
import sinon from 'sinon';
55
import './multi-select-combo-box-test-styles.js';
66
import '../src/vaadin-multi-select-combo-box.js';
@@ -134,6 +134,15 @@ describe('basic', () => {
134134
expect(comboBox.selectedItems).to.deep.equal([]);
135135
});
136136

137+
it('should not clear selected items on Esc when clear button is visible and opened', async () => {
138+
comboBox.selectedItems = ['apple', 'orange'];
139+
inputElement.focus();
140+
inputElement.click();
141+
await oneEvent(comboBox.$.overlay, 'vaadin-overlay-open');
142+
await sendKeys({ press: 'Escape' });
143+
expect(comboBox.selectedItems).to.deep.equal(['apple', 'orange']);
144+
});
145+
137146
it('should not clear selected items on Esc when clear button is not visible', async () => {
138147
comboBox.selectedItems = ['apple', 'orange'];
139148
comboBox.clearButtonVisible = false;

0 commit comments

Comments
 (0)