gecko/browser/devtools/scratchpad/test/browser_scratchpad_help_key.js
Peiyong Lin 3e5987353c Bug 937953 - Remove bug numbers from all Scratchpad test file names and update browser.ini. r=benvie
--HG--
rename : browser/devtools/scratchpad/test/browser_scratchpad_bug807924_cannot_convert_to_string.js => browser/devtools/scratchpad/test/browser_scratchpad_cannot_convert_to_string.js
rename : browser/devtools/scratchpad/test/browser_scratchpad_bug_646070_chrome_context_pref.js => browser/devtools/scratchpad/test/browser_scratchpad_chrome_context_pref.js
rename : browser/devtools/scratchpad/test/browser_scratchpad_bug_653427_confirm_close.js => browser/devtools/scratchpad/test/browser_scratchpad_confirm_close.js
rename : browser/devtools/scratchpad/test/browser_scratchpad_bug756681_display_non_error_exceptions.js => browser/devtools/scratchpad/test/browser_scratchpad_display_non_error_exceptions.js
rename : browser/devtools/scratchpad/test/browser_scratchpad_bug690552_display_outputs_errors.js => browser/devtools/scratchpad/test/browser_scratchpad_display_outputs_errors.js
rename : browser/devtools/scratchpad/test/browser_scratchpad_bug_699130_edit_ui_updates.js => browser/devtools/scratchpad/test/browser_scratchpad_edit_ui_updates.js
rename : browser/devtools/scratchpad/test/browser_scratchpad_bug_679467_falsy.js => browser/devtools/scratchpad/test/browser_scratchpad_falsy.js
rename : browser/devtools/scratchpad/test/browser_scratchpad_bug714942_goto_line_ui.js => browser/devtools/scratchpad/test/browser_scratchpad_goto_line_ui.js
rename : browser/devtools/scratchpad/test/browser_scratchpad_bug_650760_help_key.js => browser/devtools/scratchpad/test/browser_scratchpad_help_key.js
rename : browser/devtools/scratchpad/test/browser_scratchpad_bug_644413_modeline.js => browser/devtools/scratchpad/test/browser_scratchpad_modeline.js
rename : browser/devtools/scratchpad/test/browser_scratchpad_bug_651942_recent_files.js => browser/devtools/scratchpad/test/browser_scratchpad_recent_files.js
rename : browser/devtools/scratchpad/test/browser_scratchpad_bug740948_reload_and_run.js => browser/devtools/scratchpad/test/browser_scratchpad_reload_and_run.js
rename : browser/devtools/scratchpad/test/browser_scratchpad_bug684546_reset_undo.js => browser/devtools/scratchpad/test/browser_scratchpad_reset_undo.js
rename : browser/devtools/scratchpad/test/browser_scratchpad_bug_751744_revert_to_saved.js => browser/devtools/scratchpad/test/browser_scratchpad_revert_to_saved.js
rename : browser/devtools/scratchpad/test/browser_scratchpad_bug_660560_tab.js => browser/devtools/scratchpad/test/browser_scratchpad_tab.js
rename : browser/devtools/scratchpad/test/browser_scratchpad_bug_669612_unsaved.js => browser/devtools/scratchpad/test/browser_scratchpad_unsaved.js
rename : browser/devtools/scratchpad/test/browser_scratchpad_bug_661762_wrong_window_focus.js => browser/devtools/scratchpad/test/browser_scratchpad_wrong_window_focus.js
2013-11-15 21:47:02 -05:00

62 lines
1.7 KiB
JavaScript

/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/* Bug 650760 */
function test()
{
waitForExplicitFinish();
gBrowser.selectedTab = gBrowser.addTab();
content.location = "data:text/html,Test keybindings for opening Scratchpad MDN Documentation, bug 650760";
gBrowser.selectedBrowser.addEventListener("load", function onTabLoad() {
gBrowser.selectedBrowser.removeEventListener("load", onTabLoad, true);
ok(window.Scratchpad, "Scratchpad variable exists");
openScratchpad(runTest);
}, true);
}
function runTest()
{
let sp = gScratchpadWindow.Scratchpad;
ok(sp, "Scratchpad object exists in new window");
ok(sp.editor.hasFocus(), "the editor has focus");
let keyid = gScratchpadWindow.document.getElementById("key_openHelp");
let modifiers = keyid.getAttribute("modifiers");
let key = null;
if (keyid.getAttribute("keycode"))
key = keyid.getAttribute("keycode");
else if (keyid.getAttribute("key"))
key = keyid.getAttribute("key");
isnot(key, null, "Successfully retrieved keycode/key");
var aEvent = {
shiftKey: modifiers.match("shift"),
ctrlKey: modifiers.match("ctrl"),
altKey: modifiers.match("alt"),
metaKey: modifiers.match("meta"),
accelKey: modifiers.match("accel")
}
info("check that the MDN page is opened on \"F1\"");
let linkClicked = false;
sp.openDocumentationPage = function(event) { linkClicked = true; };
EventUtils.synthesizeKey(key, aEvent, gScratchpadWindow);
is(linkClicked, true, "MDN page will open");
finishTest();
}
function finishTest()
{
gScratchpadWindow.close();
finish();
}