@happy-dom/jest-environment 9.8.0 → 9.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@happy-dom/jest-environment",
|
3
|
-
"version": "9.8.
|
3
|
+
"version": "9.8.2",
|
4
4
|
"license": "MIT",
|
5
5
|
"homepage": "https://github.com/capricorn86/happy-dom/tree/master/packages/jest-environment",
|
6
6
|
"repository": "https://github.com/capricorn86/happy-dom",
|
@@ -31,7 +31,7 @@
|
|
31
31
|
"lint:fix": "eslint --ignore-path .gitignore --max-warnings 0 --fix .",
|
32
32
|
"test": "jest",
|
33
33
|
"test:watch": "jest --watch",
|
34
|
-
"test:debug": "node --inspect-brk ../../node_modules/.bin/jest --runInBand"
|
34
|
+
"test:debug": "node --inspect-brk ../../node_modules/.bin/jest --runInBand --testTimeout 60000"
|
35
35
|
},
|
36
36
|
"jest": {
|
37
37
|
"transform": {
|
@@ -54,7 +54,7 @@
|
|
54
54
|
"@jest/types": "^29.4.0",
|
55
55
|
"jest-mock": "^29.4.0",
|
56
56
|
"jest-util": "^29.4.0",
|
57
|
-
"happy-dom": "^9.8.
|
57
|
+
"happy-dom": "^9.8.2"
|
58
58
|
},
|
59
59
|
"devDependencies": {
|
60
60
|
"@typescript-eslint/eslint-plugin": "^5.16.0",
|
@@ -12,4 +12,24 @@ describe('TestingLibrary', () => {
|
|
12
12
|
await user.type(screen.getByRole('textbox'), 'hello');
|
13
13
|
expect(onChange).toHaveBeenCalledWith('hello');
|
14
14
|
});
|
15
|
+
|
16
|
+
it('Triggers click and submit event once.', async () => {
|
17
|
+
const user = userEvent.setup();
|
18
|
+
const handleSubmit = jest.fn((ev) => {
|
19
|
+
ev.preventDefault();
|
20
|
+
});
|
21
|
+
const clickHandler = jest.fn();
|
22
|
+
|
23
|
+
render(
|
24
|
+
<form onSubmit={handleSubmit}>
|
25
|
+
<button type="submit" onClick={clickHandler}>
|
26
|
+
submit
|
27
|
+
</button>
|
28
|
+
</form>
|
29
|
+
);
|
30
|
+
|
31
|
+
await user.click(screen.getByRole('button'));
|
32
|
+
expect(handleSubmit).toHaveBeenCalledTimes(1);
|
33
|
+
expect(clickHandler).toHaveBeenCalledTimes(1);
|
34
|
+
});
|
15
35
|
});
|