Merge "Add keyboard shortcuts for expanding and collapsing all messages"
This commit is contained in:
@@ -129,6 +129,8 @@
|
||||
'd': '_handleDKey',
|
||||
's': '_handleSKey',
|
||||
'u': '_handleUKey',
|
||||
'x': '_handleXKey',
|
||||
'z': '_handleZKey',
|
||||
},
|
||||
|
||||
attached: function() {
|
||||
@@ -652,6 +654,22 @@
|
||||
this._determinePageBack();
|
||||
},
|
||||
|
||||
_handleXKey: function(e) {
|
||||
if (this.shouldSuppressKeyboardShortcut(e) ||
|
||||
this.modifierPressed(e)) { return; }
|
||||
|
||||
e.preventDefault();
|
||||
this.$.messageList.handleExpandCollapse(true);
|
||||
},
|
||||
|
||||
_handleZKey: function(e) {
|
||||
if (this.shouldSuppressKeyboardShortcut(e) ||
|
||||
this.modifierPressed(e)) { return; }
|
||||
|
||||
e.preventDefault();
|
||||
this.$.messageList.handleExpandCollapse(false);
|
||||
},
|
||||
|
||||
_determinePageBack: function() {
|
||||
// Default backPage to '/' if user came to change view page
|
||||
// via an email link, etc.
|
||||
|
||||
@@ -85,6 +85,20 @@ limitations under the License.
|
||||
assert.isFalse(overlayEl.opened);
|
||||
});
|
||||
|
||||
test('X should expand all messages', function() {
|
||||
var handleExpand =
|
||||
sandbox.stub(element.$.messageList, 'handleExpandCollapse');
|
||||
MockInteractions.pressAndReleaseKeyOn(element, 88, null, 'x');
|
||||
assert(handleExpand.calledWith(true));
|
||||
});
|
||||
|
||||
test('Z should collapse all messages', function() {
|
||||
var handleExpand =
|
||||
sandbox.stub(element.$.messageList, 'handleExpandCollapse');
|
||||
MockInteractions.pressAndReleaseKeyOn(element, 90, null, 'z');
|
||||
assert(handleExpand.calledWith(false));
|
||||
});
|
||||
|
||||
test('shift + R should fetch and navigate to the latest patch set',
|
||||
function(done) {
|
||||
element._changeNum = '42';
|
||||
|
||||
Reference in New Issue
Block a user