mirror of
https://github.com/tridactyl/tridactyl.git
synced 2026-09-10 07:16:33 -04:00
Update tests and docs
This commit is contained in:
parent
0a9e073aaf
commit
3a51611161
|
|
@ -346,18 +346,18 @@ function test_url_graft_path() {
|
|||
|
||||
function test_url_query_interpolation() {
|
||||
let cases = [
|
||||
["http://example.com/%s000", "a/query", "http://example.com/a/query000"],
|
||||
["http://example.com/%s000", "a/query", "http://example.com/a%2Fquery000"],
|
||||
[
|
||||
// not percent-encoded and appended
|
||||
// appended to the path
|
||||
"http://example.com",
|
||||
"a/query",
|
||||
"http://example.com/a/query",
|
||||
"http://example.com/a%2Fquery",
|
||||
],
|
||||
[
|
||||
// not percent-encoded and interpolated
|
||||
// interpolated into the path
|
||||
"http://example.com/%s/path",
|
||||
"a/query",
|
||||
"http://example.com/a/query/path",
|
||||
"http://example.com/a%2Fquery/path",
|
||||
],
|
||||
[
|
||||
// percent-encoded and appended
|
||||
|
|
|
|||
|
|
@ -439,14 +439,13 @@ export function searchUrlToArgs(
|
|||
* If the URL pattern contains "%s", the query is interpolated there. If not,
|
||||
* it is appended to the end of the pattern.
|
||||
*
|
||||
* If the interpolation point is in the query string of the URL, it is
|
||||
* percent encoded, otherwise it is is inserted verbatim.
|
||||
* The search item is percent encoded before it is inserted.
|
||||
*
|
||||
* @param urlPattern a URL to interpolate/append a query to
|
||||
* @param query a query to interpolate/append into the URL
|
||||
*
|
||||
* @return the URL with the query encoded (if needed) and
|
||||
* inserted at the relevant point
|
||||
* @return the URL with the query encoded and inserted at the
|
||||
* relevant point
|
||||
*/
|
||||
export function interpolateSearchItem(urlPattern: URL, query: string): URL {
|
||||
const hasInterpolationPoint = urlPattern.href.includes("%s")
|
||||
|
|
|
|||
Loading…
Reference in a new issue