gecko-dev/browser/metro/base/tests/browser_canonizeURL.js
2013-02-12 14:51:25 -06:00

22 lines
840 B
JavaScript

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
function test() {
let testcases = [
["example", {}, "example"],
["example", {ctrlKey: true}, "http://www.example.com/"],
["example.org", {ctrlKey: true}, "example.org"],
["example", {shiftKey: true}, "http://www.example.net/"],
["example", {shiftKey: true, ctrlKey: true}, "http://www.example.org/"],
[" example ", {ctrlKey: true}, "http://www.example.com/"],
[" example/a ", {ctrlKey: true}, "http://www.example.com/a"]
];
for (let [input, modifiers, result] of testcases) {
is(BrowserUI._canonizeURL(input, modifiers), result, input + " -> " + result);
}
}