diff -r 000000000000 -r 6474c204b198 browser/metro/base/tests/mochitest/browser_canonizeURL.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/metro/base/tests/mochitest/browser_canonizeURL.js Wed Dec 31 06:09:35 2014 +0100 @@ -0,0 +1,21 @@ +/* -*- 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._edit._canonizeURL(input, modifiers), result, input + " -> " + result); + } +}