mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 13:25:37 +00:00
Bug 649307 - focused tab is opened after naming a group and pressing enter [f=raymond, r=ian]
This commit is contained in:
parent
d5b22b24ca
commit
abdbb5027a
@ -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
|
||||
|
@ -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 \
|
||||
|
@ -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);
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue
Block a user