Skip to content

Commit 5b1a920

Browse files
fix: add test
1 parent fde8fad commit 5b1a920

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/new-range.spec.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,6 +1010,19 @@ describe('NewPicker.Range', () => {
10101010
expect(startInput.selectionEnd).toEqual(6);
10111011
});
10121012

1013+
it('focus by mousedown defers selection sync to mouseUp', () => {
1014+
const { container } = render(<Demo />);
1015+
1016+
const startInput = container.querySelectorAll<HTMLInputElement>('input')[0];
1017+
1018+
fireEvent.mouseDown(startInput);
1019+
fireEvent.focus(startInput);
1020+
1021+
fireEvent.mouseUp(startInput);
1022+
expect(startInput.selectionStart).toBeDefined();
1023+
expect(startInput.selectionEnd).toBeDefined();
1024+
});
1025+
10131026
it('blur to reset back text', async () => {
10141027
const { container } = render(<Demo />);
10151028

0 commit comments

Comments
 (0)