Bump Jest version

This commit is contained in:
Francisco Hodge
2024-09-12 17:35:31 -04:00
parent 536f3f7419
commit 3495c3ee4d
4 changed files with 2906 additions and 7620 deletions
+1 -36
View File
@@ -216,7 +216,7 @@ it('CandidateBox select candidate will work', () => {
keyboard.getButtonElement("a").click();
keyboard.candidateBox.candidateBoxElement.querySelector("li").click();
expect(onSelect).toBeCalledWith("1", expect.anything());
expect(onSelect).toHaveBeenCalledWith("1", expect.anything());
keyboard.destroy();
});
@@ -371,41 +371,6 @@ it('CandidateBox selection should trigger onChange', () => {
keyboard.destroy();
});
it('CandidateBox selection should trigger beforeInputChange', () => {
const keyboard = new Keyboard({
layout: {
default: [
"a b {bksp}"
]
},
layoutCandidates: {
a: "1 2 3 4 5 6"
},
beforeInputUpdate: jest.fn(),
});
let candidateBoxOnItemSelected;
const onSelect = jest.fn().mockImplementation((selectedCandidate) => {
candidateBoxOnItemSelected(selectedCandidate);
keyboard.candidateBox.destroy();
});
const candidateBoxRenderFn = keyboard.candidateBox.renderPage;
jest.spyOn(keyboard.candidateBox, "renderPage").mockImplementation((params) => {
candidateBoxOnItemSelected = params.onItemSelected;
params.onItemSelected = onSelect;
candidateBoxRenderFn(params);
});
keyboard.getButtonElement("a").click();
keyboard.candidateBox.candidateBoxElement.querySelector("li").click();
expect(keyboard.options.beforeInputUpdate.mock.calls[0][0]).toMatchObject(keyboard);
keyboard.destroy();
});
it('CandidateBox normalization will work', () => {
const keyboard = new Keyboard({
layout: {
@@ -212,7 +212,7 @@ it('PhysicalKeyboard keyCodeToKey will work', () => {
expect(keyboard.physicalKeyboard.keyCodeToKey(186)).toBe(";");
const methodTest = spyOn(keyboard.physicalKeyboard, "keyCodeToKey");
const methodTest = jest.spyOn(keyboard.physicalKeyboard, "keyCodeToKey");
document.dispatchEvent(new KeyboardEvent('keyup', {
keyCode: 186,
@@ -221,5 +221,5 @@ it('PhysicalKeyboard keyCodeToKey will work', () => {
}
}));
expect(methodTest).toBeCalledWith(186);
expect(methodTest).toHaveBeenCalledWith(186);
});