1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/mozapps/extensions/test/browser/browser_bug570760.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,41 @@ 1.4 +/* Any copyright is dedicated to the Public Domain. 1.5 + * http://creativecommons.org/publicdomain/zero/1.0/ 1.6 + */ 1.7 + 1.8 +// Bug 570760 - Make ctrl-f and / focus the search box in the add-ons manager 1.9 + 1.10 +var gManagerWindow; 1.11 +var focusCount = 0; 1.12 + 1.13 +function test() { 1.14 + waitForExplicitFinish(); 1.15 + 1.16 + open_manager(null, function(aWindow) { 1.17 + gManagerWindow = aWindow; 1.18 + 1.19 + var searchBox = gManagerWindow.document.getElementById("header-search"); 1.20 + function focusHandler() { 1.21 + searchBox.blur(); 1.22 + focusCount++; 1.23 + } 1.24 + searchBox.addEventListener("focus", focusHandler); 1.25 + f_key_test(); 1.26 + slash_key_test(); 1.27 + searchBox.removeEventListener("focus", focusHandler); 1.28 + end_test(); 1.29 + }); 1.30 +} 1.31 + 1.32 +function end_test() { 1.33 + close_manager(gManagerWindow, finish); 1.34 +} 1.35 + 1.36 +function f_key_test() { 1.37 + EventUtils.synthesizeKey("f", { accelKey: true }, gManagerWindow); 1.38 + is(focusCount, 1, "Search box should have been focused due to the f key"); 1.39 +} 1.40 + 1.41 +function slash_key_test() { 1.42 + EventUtils.synthesizeKey("/", { }, gManagerWindow); 1.43 + is(focusCount, 2, "Search box should have been focused due to the / key"); 1.44 +}