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

10465
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "simple-keyboard",
"version": "3.7.108",
"version": "3.8.0",
"description": "On-screen Javascript Virtual Keyboard",
"main": "build/index.js",
"scripts": {
@ -45,7 +45,7 @@
"@babel/plugin-transform-typescript": "^7.25.2",
"@babel/polyfill": "^7.12.1",
"@babel/preset-env": "^7.25.4",
"@types/jest": "^27.5.0",
"@types/jest": "^29.5.13",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"autoprefixer": "^10.4.20",
@ -58,7 +58,8 @@
"eslint": "^8.57.0",
"file-loader": "^6.2.0",
"html-webpack-plugin": "^5.6.0",
"jest": "^26.6.3",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"mini-css-extract-plugin": "^2.9.1",
"postcss": "^8.4.45",
"postcss-loader": "^8.1.1",
@ -71,6 +72,7 @@
"webpack-dev-server": "4.15.0"
},
"jest": {
"testEnvironment": "jsdom",
"roots": [
"<rootDir>/src"
],

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: {

View File

@ -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);
});