1
1
mirror of https://github.com/ariya/phantomjs.git synced 2024-09-11 12:55:33 +03:00
phantomjs/test/basics/url-utils.js
Zack Weinberg 305cc4467a Add phantom.resolveRelativeUrl and phantom.fullyDecodeUrl.
These utility functions make it easier to work with encoded URLs.
See issues #12216 and #11035.
2015-12-03 14:53:10 -05:00

17 lines
536 B
JavaScript

// These are cursory tests; we assume the underlying Qt
// features are properly tested elsewhere.
test(function () {
assert_equals(
phantom.resolveRelativeUrl(
"../scripts/foo.js",
"http://example.com/topic/page.html"),
"http://example.com/scripts/foo.js");
assert_equals(
phantom.fullyDecodeUrl(
"https://ja.wikipedia.org/wiki/%E8%87%A8%E6%B5%B7%E5%AD%A6%E6%A0%A1"),
"https://ja.wikipedia.org/wiki/臨海学校");
}, "resolveRelativeUrl and fullyDecodeUrl");