• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2
3require('../common');
4const assert = require('assert');
5
6{
7  const url = new (class extends URL { get hostname() { return 'bar.com'; } })('http://foo.com/');
8  assert.strictEqual(url.href, 'http://foo.com/');
9  assert.strictEqual(url.toString(), 'http://foo.com/');
10  assert.strictEqual(url.toJSON(), 'http://foo.com/');
11  assert.strictEqual(url.hash, '');
12  assert.strictEqual(url.host, 'foo.com');
13  assert.strictEqual(url.hostname, 'bar.com');
14  assert.strictEqual(url.origin, 'http://foo.com');
15  assert.strictEqual(url.password, '');
16  assert.strictEqual(url.protocol, 'http:');
17  assert.strictEqual(url.username, '');
18  assert.strictEqual(url.search, '');
19  assert.strictEqual(url.searchParams.toString(), '');
20}
21