зеркало из https://github.com/mozilla/pjs.git
Bug 607108 - focus group name field after creating new group; f=raymond, r=ehsan
This commit is contained in:
Родитель
98db494021
Коммит
137863ba7d
|
@ -64,6 +64,7 @@
|
|||
// bounds - a <Rect>; otherwise based on the locations of the provided elements
|
||||
// container - a DOM element to use as the container for this groupItem; otherwise will create
|
||||
// title - the title for the groupItem; otherwise blank
|
||||
// focusTitle - focus the title's input field after creation
|
||||
// dontPush - true if this groupItem shouldn't push away or snap on creation; default is false
|
||||
// immediately - true if we want all placement immediately, not with animation
|
||||
function GroupItem(listOfEls, options) {
|
||||
|
@ -218,12 +219,13 @@ function GroupItem(listOfEls, options) {
|
|||
if (!same)
|
||||
return;
|
||||
|
||||
if (!self.isDragging) {
|
||||
self.$titleShield.hide();
|
||||
(self.$title)[0].focus();
|
||||
}
|
||||
if (!self.isDragging)
|
||||
self.focusTitle();
|
||||
});
|
||||
|
||||
if (options.focusTitle)
|
||||
this.focusTitle();
|
||||
|
||||
// ___ Stack Expander
|
||||
this.$expander = iQ("<div/>")
|
||||
.addClass("stackExpander")
|
||||
|
@ -404,6 +406,14 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
|
|||
this.$titleShield.css(css);
|
||||
},
|
||||
|
||||
// ----------
|
||||
// Function: focusTitle
|
||||
// Hide the title's shield and focus the underlying input field.
|
||||
focusTitle: function GroupItem_focusTitle() {
|
||||
this.$titleShield.hide();
|
||||
this.$title[0].focus();
|
||||
},
|
||||
|
||||
// ----------
|
||||
// Function: adjustAppTabTray
|
||||
// Used to adjust the appTabTray size, to split the appTabIcons across
|
||||
|
|
|
@ -1321,7 +1321,8 @@ let UI = {
|
|||
insideTabs.push(tab);
|
||||
}
|
||||
|
||||
var groupItem = new GroupItem(insideTabs,{bounds:bounds});
|
||||
let opts = {bounds: bounds, focusTitle: true};
|
||||
let groupItem = new GroupItem(insideTabs, opts);
|
||||
self.setActive(groupItem);
|
||||
phantom.remove();
|
||||
dragOutInfo = null;
|
||||
|
|
|
@ -85,6 +85,7 @@ _BROWSER_FILES = \
|
|||
browser_tabview_bug604699.js \
|
||||
browser_tabview_bug606657.js \
|
||||
browser_tabview_bug606905.js \
|
||||
browser_tabview_bug607108.js \
|
||||
browser_tabview_bug608037.js \
|
||||
browser_tabview_bug608184.js \
|
||||
browser_tabview_bug608158.js \
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
newWindowWithTabView(function (win) {
|
||||
registerCleanupFunction(function () win.close());
|
||||
|
||||
let cw = win.TabView.getContentWindow();
|
||||
let content = cw.document.getElementById("content");
|
||||
|
||||
let groupItems = cw.GroupItems.groupItems;
|
||||
is(groupItems.length, 1, "there is one groupItem");
|
||||
groupItems[0].setSize(150, 150, true);
|
||||
|
||||
waitForFocus(function () {
|
||||
// drag to create a new group
|
||||
EventUtils.synthesizeMouse(content, 200, 50, {type: "mousedown"}, cw);
|
||||
EventUtils.synthesizeMouse(content, 400, 250, {type: "mousemove"}, cw);
|
||||
EventUtils.synthesizeMouse(content, 200, 50, {type: "mouseup"}, cw);
|
||||
|
||||
// enter a title for the new group
|
||||
EventUtils.synthesizeKey("t", {}, cw);
|
||||
EventUtils.synthesizeKey("VK_RETURN", {}, cw);
|
||||
|
||||
is(groupItems.length, 2, "there are two groupItems");
|
||||
is(groupItems[1].getTitle(), "t", "new groupItem's title is correct");
|
||||
|
||||
waitForFocus(finish);
|
||||
}, cw);
|
||||
});
|
||||
}
|
Загрузка…
Ссылка в новой задаче