1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/metro/base/tests/mochitest/browser_canonizeURL.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,21 @@ 1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* vim: set ts=2 et sw=2 tw=80: */ 1.6 +/* Any copyright is dedicated to the Public Domain. 1.7 + http://creativecommons.org/publicdomain/zero/1.0/ */ 1.8 + 1.9 +"use strict"; 1.10 + 1.11 +function test() { 1.12 + let testcases = [ 1.13 + ["example", {}, "example"], 1.14 + ["example", {ctrlKey: true}, "http://www.example.com/"], 1.15 + ["example.org", {ctrlKey: true}, "example.org"], 1.16 + ["example", {shiftKey: true}, "http://www.example.net/"], 1.17 + ["example", {shiftKey: true, ctrlKey: true}, "http://www.example.org/"], 1.18 + [" example ", {ctrlKey: true}, "http://www.example.com/"], 1.19 + [" example/a ", {ctrlKey: true}, "http://www.example.com/a"] 1.20 + ]; 1.21 + for (let [input, modifiers, result] of testcases) { 1.22 + is(BrowserUI._edit._canonizeURL(input, modifiers), result, input + " -> " + result); 1.23 + } 1.24 +}