haikuwebkit/LayoutTests/fast/url/url-tojson.html

15 lines
644 B
HTML

<!DOCTYPE html>
<body>
<script src="../../resources/js-test.js"></script>
<script>
description("Basic test for URL.toJSON()");
shouldBeEqualToString("new URL('https://example.com/').toJSON()", "https://example.com/");
shouldBeEqualToString("new URL('https://example.com/').toString()", "https://example.com/");
shouldBeEqualToString("new URL('https://example.com/').href", "https://example.com/");
shouldBeEqualToString("JSON.stringify(new URL('https://example.com/#\"'))", "\"https://example.com/#%22\"");
shouldBeEqualToString("JSON.parse(JSON.stringify(new URL('https://example.com/#\"')))", "https://example.com/#%22");
</script>
</body>