Bug 649307 - focused tab is opened after naming a group and pressing enter [f=raymond, r=ian]

This commit is contained in:
Tim Taubert 2011-04-21 19:54:24 +02:00
parent bf2870ba02
commit 65ef0d6c23
3 changed files with 49 additions and 3 deletions

View File

@ -166,8 +166,10 @@ function GroupItem(listOfEls, options) {
this.$titleShield = iQ('.title-shield', this.$titlebar);
this.setTitle(options.title);
var handleKeyDown = function(e) {
if (e.which == 13 || e.which == 27) { // return & escape
var handleKeyPress = function (e) {
if (e.keyCode == KeyEvent.DOM_VK_ESCAPE ||
e.keyCode == KeyEvent.DOM_VK_RETURN ||
e.keyCode == KeyEvent.DOM_VK_ENTER) {
(self.$title)[0].blur();
self.$title
.addClass("transparentBorder")
@ -204,7 +206,7 @@ function GroupItem(listOfEls, options) {
.mousedown(function(e) {
e.stopPropagation();
})
.keydown(handleKeyDown)
.keypress(handleKeyPress)
.keyup(handleKeyUp);
this.$titleShield

View File

@ -131,6 +131,7 @@ _BROWSER_FILES = \
browser_tabview_bug644097.js \
browser_tabview_bug645653.js \
browser_tabview_bug649006.js \
browser_tabview_bug649307.js \
browser_tabview_dragdrop.js \
browser_tabview_exit_button.js \
browser_tabview_expander.js \

View File

@ -0,0 +1,43 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
function test() {
waitForExplicitFinish();
newWindowWithTabView(function (win) {
let cw = win.TabView.getContentWindow();
registerCleanupFunction(function () {
cw.gPrefBranch.clearUserPref("animate_zoom");
win.close();
});
cw.gPrefBranch.setBoolPref("animate_zoom", false);
let groupItem = cw.GroupItems.groupItems[0];
let shield = groupItem.$titleShield[0];
let keys = ["RETURN", "ENTER", "ESCAPE"];
ok(win.TabView.isVisible(), "tabview is visible");
let simulateKeyPress = function () {
let key = keys.shift();
if (!key) {
ok(win.TabView.isVisible(), "tabview is still visible");
finish();
return;
}
EventUtils.synthesizeMouseAtCenter(shield, {}, cw);
EventUtils.synthesizeKey("VK_" + key, {}, cw);
executeSoon(function () {
ok(win.TabView.isVisible(), "tabview is still visible [" + key + "]");
simulateKeyPress();
});
}
SimpleTest.waitForFocus(simulateKeyPress, cw);
});
}