Skip to content

Commit 4fd3902

Browse files
committed
fixup! fix(aria/combobox): highlighting edge cases
1 parent c6a27c1 commit 4fd3902

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/aria/combobox/combobox.spec.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,11 +245,13 @@ describe('Combobox', () => {
245245
it('should close then clear the completion string', () => {
246246
fixture.componentInstance.filterMode.set('highlight');
247247
focus();
248-
input('A');
248+
input('Ala');
249249
expect(inputElement.value).toBe('Alabama');
250250
expect(inputElement.getAttribute('aria-expanded')).toBe('true');
251251
escape();
252252
expect(inputElement.value).toBe('Alabama');
253+
expect(inputElement.selectionEnd).toBe(7);
254+
expect(inputElement.selectionStart).toBe(3);
253255
expect(inputElement.getAttribute('aria-expanded')).toBe('false'); // close
254256
escape();
255257
expect(inputElement.value).toBe(''); // clear input
@@ -460,15 +462,15 @@ describe('Combobox', () => {
460462
// TODO(wagnermaciel): Add unit tests for disabled options.
461463

462464
describe('Filtering', () => {
463-
beforeEach(() => setupCombobox());
464-
465465
it('should lazily render options', () => {
466+
setupCombobox();
466467
expect(getOptions().length).toBe(0);
467468
focus();
468469
expect(getOptions().length).toBe(50);
469470
});
470471

471472
it('should filter the options based on the input value', () => {
473+
setupCombobox();
472474
focus();
473475
input('New');
474476

@@ -481,13 +483,15 @@ describe('Combobox', () => {
481483
});
482484

483485
it('should show no options if nothing matches', () => {
486+
setupCombobox();
484487
focus();
485488
input('xyz');
486489
const options = getOptions();
487490
expect(options.length).toBe(0);
488491
});
489492

490493
it('should show all options when the input is cleared', () => {
494+
setupCombobox();
491495
focus();
492496
input('Alabama');
493497
expect(getOptions().length).toBe(1);

0 commit comments

Comments
 (0)