@happy-dom/jest-environment 7.7.2 → 7.8.0

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": "7.7.2",
3
+ "version": "7.8.0",
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",
@@ -52,7 +52,7 @@
52
52
  "@jest/environment": "^27.5.1",
53
53
  "@jest/fake-timers": "^27.5.1",
54
54
  "@jest/types": "^27.5.1",
55
- "happy-dom": "^7.7.2",
55
+ "happy-dom": "^7.8.0",
56
56
  "jest-mock": "^27.5.1",
57
57
  "jest-util": "^27.5.1"
58
58
  },
@@ -93,5 +93,5 @@
93
93
  "vue": "^3.2.31",
94
94
  "zone.js": "^0.10.3"
95
95
  },
96
- "gitHead": "093d64988c193f17a4fde5fb039ee88c8f2adaa0"
96
+ "gitHead": "75d996d3778531592ea945c2d245b25ad0e87190"
97
97
  }
@@ -26,6 +26,49 @@ describe('JavaScript', () => {
26
26
  expect(body.includes('node_modules')).toBe(true);
27
27
  });
28
28
 
29
+ it('Can perform a real asynchronous XMLHttpRequest request to Github.com', (done) => {
30
+ const request = new XMLHttpRequest();
31
+
32
+ request.open(
33
+ 'GET',
34
+ 'https://raw.githubusercontent.com/capricorn86/happy-dom/master/.gitignore',
35
+ true
36
+ );
37
+
38
+ request.addEventListener('load', () => {
39
+ expect(request.getResponseHeader('content-type')).toBe('text/plain; charset=utf-8');
40
+ expect(request.responseText.includes('node_modules')).toBe(true);
41
+ expect(request.status).toBe(200);
42
+ expect(request.statusText).toBe('OK');
43
+ expect(request.responseURL).toBe(
44
+ 'https://raw.githubusercontent.com/capricorn86/happy-dom/master/.gitignore'
45
+ );
46
+ done();
47
+ });
48
+
49
+ request.send();
50
+ });
51
+
52
+ it('Can perform a real synchronous XMLHttpRequest request to Github.com', () => {
53
+ const request = new XMLHttpRequest();
54
+
55
+ request.open(
56
+ 'GET',
57
+ 'https://raw.githubusercontent.com/capricorn86/happy-dom/master/.gitignore',
58
+ false
59
+ );
60
+
61
+ request.send();
62
+
63
+ expect(request.getResponseHeader('content-type')).toBe('text/plain; charset=utf-8');
64
+ expect(request.responseText.includes('node_modules')).toBe(true);
65
+ expect(request.status).toBe(200);
66
+ expect(request.statusText).toBe('OK');
67
+ expect(request.responseURL).toBe(
68
+ 'https://raw.githubusercontent.com/capricorn86/happy-dom/master/.gitignore'
69
+ );
70
+ });
71
+
29
72
  it('Binds global methods to the Window context', () => {
30
73
  const eventListener = (): void => {};
31
74
  addEventListener('click', eventListener);