зеркало из https://github.com/mozilla/pjs.git
Bug 618816 - Character by character selection using the mouse in the tab group name field [r=ian, a=sdwilsh]
This commit is contained in:
Родитель
b5d7f047c2
Коммит
67ba337636
|
@ -188,10 +188,17 @@ function GroupItem(listOfEls, options) {
|
|||
|
||||
this.$title
|
||||
.blur(function() {
|
||||
self._titleFocused = false;
|
||||
self.$titleShield.show();
|
||||
})
|
||||
.focus(function() {
|
||||
(self.$title)[0].select();
|
||||
if (!self._titleFocused) {
|
||||
(self.$title)[0].select();
|
||||
self._titleFocused = true;
|
||||
}
|
||||
})
|
||||
.mousedown(function(e) {
|
||||
e.stopPropagation();
|
||||
})
|
||||
.keydown(handleKeyDown)
|
||||
.keyup(handleKeyUp);
|
||||
|
|
|
@ -86,6 +86,7 @@ _BROWSER_FILES = \
|
|||
browser_tabview_bug613541.js \
|
||||
browser_tabview_bug616729.js \
|
||||
browser_tabview_bug616967.js \
|
||||
browser_tabview_bug618816.js \
|
||||
browser_tabview_bug618828.js \
|
||||
browser_tabview_bug619937.js \
|
||||
browser_tabview_bug622835.js \
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
function test() {
|
||||
let cw;
|
||||
|
||||
let createGroupItem = function () {
|
||||
let bounds = new cw.Rect(20, 20, 400, 200);
|
||||
let groupItem = new cw.GroupItem([], {bounds: bounds, immediately: true});
|
||||
|
||||
let groupItemId = groupItem.id;
|
||||
registerCleanupFunction(function() {
|
||||
let groupItem = cw.GroupItems.groupItem(groupItemId);
|
||||
if (groupItem)
|
||||
groupItem.close();
|
||||
});
|
||||
|
||||
return groupItem;
|
||||
}
|
||||
|
||||
let testFocusTitle = function () {
|
||||
let title = 'title';
|
||||
let groupItem = createGroupItem();
|
||||
groupItem.setTitle(title);
|
||||
|
||||
let target = groupItem.$titleShield[0];
|
||||
EventUtils.synthesizeMouseAtCenter(target, {}, cw);
|
||||
|
||||
let input = groupItem.$title[0];
|
||||
is(input.selectionStart, 0, 'the whole text is selected');
|
||||
is(input.selectionEnd, title.length, 'the whole text is selected');
|
||||
|
||||
EventUtils.synthesizeMouseAtCenter(input, {}, cw);
|
||||
is(input.selectionStart, title.length, 'caret is at the rightmost position and no text is selected');
|
||||
is(input.selectionEnd, title.length, 'caret is at the rightmost position and no text is selected');
|
||||
|
||||
groupItem.close();
|
||||
hideTabView(finish);
|
||||
}
|
||||
|
||||
waitForExplicitFinish();
|
||||
|
||||
showTabView(function () {
|
||||
cw = TabView.getContentWindow();
|
||||
testFocusTitle();
|
||||
});
|
||||
}
|
Загрузка…
Ссылка в новой задаче