michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: * http://creativecommons.org/publicdomain/zero/1.0/ michael@0: */ michael@0: michael@0: // Bug 570760 - Make ctrl-f and / focus the search box in the add-ons manager michael@0: michael@0: var gManagerWindow; michael@0: var focusCount = 0; michael@0: michael@0: function test() { michael@0: waitForExplicitFinish(); michael@0: michael@0: open_manager(null, function(aWindow) { michael@0: gManagerWindow = aWindow; michael@0: michael@0: var searchBox = gManagerWindow.document.getElementById("header-search"); michael@0: function focusHandler() { michael@0: searchBox.blur(); michael@0: focusCount++; michael@0: } michael@0: searchBox.addEventListener("focus", focusHandler); michael@0: f_key_test(); michael@0: slash_key_test(); michael@0: searchBox.removeEventListener("focus", focusHandler); michael@0: end_test(); michael@0: }); michael@0: } michael@0: michael@0: function end_test() { michael@0: close_manager(gManagerWindow, finish); michael@0: } michael@0: michael@0: function f_key_test() { michael@0: EventUtils.synthesizeKey("f", { accelKey: true }, gManagerWindow); michael@0: is(focusCount, 1, "Search box should have been focused due to the f key"); michael@0: } michael@0: michael@0: function slash_key_test() { michael@0: EventUtils.synthesizeKey("/", { }, gManagerWindow); michael@0: is(focusCount, 2, "Search box should have been focused due to the / key"); michael@0: }