0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/parallel/test-whatwg-url-historical.js
Joyee Cheung 10b687b58b test, url: synchronize WPT url tests
* attributon of WPT in url-setter-tests
* add WPT test utilities
* synchronize WPT URLSearchParams tests
* synchronize WPT url tests
* split whatwg-url-inspect test
* port historical url tests from WPT
* protocol setter and special URLs

Refs: https://github.com/w3c/web-platform-tests/pull/4413
Refs: https://github.com/whatwg/url/issues/104
PR-URL: https://github.com/nodejs/node/pull/11079
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
2017-02-02 11:46:52 -08:00

47 lines
1.4 KiB
JavaScript

'use strict';
const common = require('../common');
const URL = require('url').URL;
const { test, assert_equals, assert_throws } = common.WPT;
if (!common.hasIntl) {
// A handful of the tests fail when ICU is not included.
common.skip('missing Intl');
return;
}
/* eslint-disable */
/* WPT Refs:
https://github.com/w3c/web-platform-tests/blob/8791bed/url/historical.html
License: http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html
*/
// var objects = [
// [function() { return window.location }, "location object"],
// [function() { return document.createElement("a") }, "a element"],
// [function() { return document.createElement("area") }, "area element"],
// ];
// objects.forEach(function(o) {
// test(function() {
// var object = o[0]();
// assert_false("searchParams" in object,
// o[1] + " should not have a searchParams attribute");
// }, "searchParams on " + o[1]);
// });
test(function() {
var url = new URL("./foo", "http://www.example.org");
assert_equals(url.href, "http://www.example.org/foo");
assert_throws(new TypeError(), function() {
url.href = "./bar";
});
}, "Setting URL's href attribute and base URLs");
test(function() {
assert_equals(URL.domainToASCII, undefined);
}, "URL.domainToASCII should be undefined");
test(function() {
assert_equals(URL.domainToUnicode, undefined);
}, "URL.domainToUnicode should be undefined");
/* eslint-enable */