Implement URL.domainToUnicode

This commit is contained in:
Achal Shah 2016-06-05 23:27:45 -07:00 committed by Achal Shah
parent 1bc94c132e
commit a727fd2d62
5 changed files with 37 additions and 10 deletions

View file

@ -36028,7 +36028,16 @@
"local_changes": {
"deleted": [],
"deleted_reftests": {},
"items": {},
"items": {
"testharness": {
"url/url-domainToUnicode.html": [
{
"path": "url/url-domainToUnicode.html",
"url": "/url/url-domainToUnicode.html"
}
]
}
},
"reftest_nodes": {}
},
"reftest_nodes": {

View file

@ -1,8 +0,0 @@
[interfaces.html]
type: testharness
[URL interface: operation domainToUnicode(ScalarValueString)]
expected: FAIL
[URL interface: operation domainToUnicode(USVString)]
expected: FAIL

View file

@ -0,0 +1,21 @@
<!doctype html>
<meta charset="utf-8">
<title></title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
test(function() {
var domain = 'example.org'
assert_true(URL.domainToUnicode(domain) === domain, 'Ascii domain should be parsed correctly.')
}, 'URL.domainToUnicode valid input')
test(function() {
var domain = 'xn--maana-pta.com'
assert_true(URL.domainToUnicode(domain) === 'mañana.com', ' Ascii encoded domain should be parsed correctly.')
}, 'URL.domainToUnicode valid encoded input')
test(function() {
var domain = 'http://not.a.domain'
assert_true(URL.domainToUnicode(domain) === "", 'Invalid domain should be return an empty string.')
}, 'URL.domainToUnicode invalid input')
</script>