Repository: capricorn86/happy-dom (ts)

Issue:
the default pathname is '/'
Associate with #508 

```javascript
const { Window } = require('../packages/happy-dom');
const window = new Window();

const url = 'https://www.example.com';
const u = new window.URL(url);
console.log(u.pathname);
// happy-dom: ''
// browers: '/'
```

Pull request description:
#515@patch: Fixes default pathname when parse URL.
Fixes #515

Patch:
diff --git a/packages/happy-dom/src/location/URL.ts b/packages/happy-dom/src/location/URL.ts
index c1fd73c6..e66e4317 100644
--- a/packages/happy-dom/src/location/URL.ts
+++ b/packages/happy-dom/src/location/URL.ts
@@ -85,7 +85,7 @@ export default class URL {
 			this.protocol = match[1] || '';
 			this.hostname = hostnamePart.length > 1 ? hostnamePart[1] : hostnamePart[0];
 			this.port = match[3] || '';
-			this.pathname = match[4] || '';
+			this.pathname = match[4] || '/';
 			this.search = match[5] || '';
 			this.hash = match[6] || '';
 			this.username = credentialsPart ? credentialsPart[0] : '';


Test patch:
diff --git a/packages/happy-dom/test/location/URL.test.ts b/packages/happy-dom/test/location/URL.test.ts
index 806ab863..7a8477f4 100644
--- a/packages/happy-dom/test/location/URL.test.ts
+++ b/packages/happy-dom/test/location/URL.test.ts
@@ -49,5 +49,21 @@ describe('URL', () => {
 			expect(url.host).toBe('google.com:8080');
 			expect(url.origin).toBe('https://google.com:8080');
 		});
+		it('Parses "https://google.com".', () => {
+			const formatHref = 'https://google.com/';
+			const href = 'https://google.com';
+			const url = new URL(href);
+			expect(url.href).toBe(formatHref);
+			expect(url.protocol).toBe('https:');
+			expect(url.hostname).toBe('google.com');
+			expect(url.port).toBe('');
+			expect(url.pathname).toBe('/');
+			expect(url.search).toBe('');
+			expect(url.hash).toBe('');
+			expect(url.username).toBe('');
+			expect(url.password).toBe('');
+			expect(url.host).toBe('google.com');
+			expect(url.origin).toBe('https://google.com');
+		});
 	});
 });