mirror of
https://github.com/hodgef/simple-keyboard.git
synced 2025-01-19 16:52:59 +08:00
Tests update
This commit is contained in:
parent
1f9efb0c66
commit
c59f819db9
@ -598,6 +598,42 @@ it('Keyboard caretEventHandler will detect input, textarea focus', () => {
|
||||
expect(keyboard.caretPosition).toBe(3);
|
||||
});
|
||||
|
||||
it('Keyboard caretEventHandler will not set caretPosition on disableCaretPositioning', () => {
|
||||
testUtil.setDOM();
|
||||
|
||||
let keyboard = new Keyboard();
|
||||
|
||||
keyboard.caretEventHandler({
|
||||
charCode: 0,
|
||||
code: "KeyF",
|
||||
key: "f",
|
||||
which: 70,
|
||||
target: {
|
||||
tagName: "input",
|
||||
selectionStart: 3
|
||||
}
|
||||
});
|
||||
|
||||
expect(keyboard.caretPosition).toBe(3);
|
||||
|
||||
keyboard.setOptions({
|
||||
disableCaretPositioning: true
|
||||
});
|
||||
|
||||
keyboard.caretEventHandler({
|
||||
charCode: 0,
|
||||
code: "KeyF",
|
||||
key: "f",
|
||||
which: 70,
|
||||
target: {
|
||||
tagName: "input",
|
||||
selectionStart: 3
|
||||
}
|
||||
});
|
||||
|
||||
expect(keyboard.caretPosition).toBeFalsy();
|
||||
});
|
||||
|
||||
it('Keyboard caretEventHandler ignore positioning if input, textarea is blur', () => {
|
||||
testUtil.setDOM();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user