Merge "add r key shortcut to toggle review flag"
This commit is contained in:
@@ -136,6 +136,7 @@
|
|||||||
'o': '_handleOKey',
|
'o': '_handleOKey',
|
||||||
'n': '_handleNKey',
|
'n': '_handleNKey',
|
||||||
'p': '_handlePKey',
|
'p': '_handlePKey',
|
||||||
|
'r': '_handleRKey',
|
||||||
'shift+a': '_handleCapitalAKey',
|
'shift+a': '_handleCapitalAKey',
|
||||||
'esc': '_handleEscKey',
|
'esc': '_handleEscKey',
|
||||||
},
|
},
|
||||||
@@ -581,6 +582,17 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_handleRKey(e) {
|
||||||
|
if (this.shouldSuppressKeyboardShortcut(e) ||
|
||||||
|
this.modifierPressed(e) && !this.isModifierPressed(e, 'shiftKey')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
e.preventDefault();
|
||||||
|
if (!this._files[this.$.fileCursor.index]) { return; }
|
||||||
|
this._reviewFile(this._files[this.$.fileCursor.index].__path);
|
||||||
|
},
|
||||||
|
|
||||||
_handleCapitalAKey(e) {
|
_handleCapitalAKey(e) {
|
||||||
if (this.shouldSuppressKeyboardShortcut(e)) { return; }
|
if (this.shouldSuppressKeyboardShortcut(e)) { return; }
|
||||||
|
|
||||||
|
|||||||
@@ -385,6 +385,21 @@ limitations under the License.
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('r key toggles reviewed flag', () => {
|
||||||
|
flushAsynchronousOperations();
|
||||||
|
|
||||||
|
// Default state should be unreviewed.
|
||||||
|
assert.equal(element._reviewed.length, 0);
|
||||||
|
|
||||||
|
// Press the review key to toggle it (set the flag).
|
||||||
|
MockInteractions.pressAndReleaseKeyOn(element, 82, null, 'r');
|
||||||
|
assert.equal(element._reviewed.length, 1);
|
||||||
|
|
||||||
|
// Press the review key to toggle it (clear the flag).
|
||||||
|
MockInteractions.pressAndReleaseKeyOn(element, 82, null, 'r');
|
||||||
|
assert.equal(element._reviewed.length, 0);
|
||||||
|
});
|
||||||
|
|
||||||
suite('_handleOKey', () => {
|
suite('_handleOKey', () => {
|
||||||
let interact;
|
let interact;
|
||||||
|
|
||||||
|
|||||||
@@ -234,6 +234,10 @@ limitations under the License.
|
|||||||
<td><span class="key">o</span></td>
|
<td><span class="key">o</span></td>
|
||||||
<td>Show selected file</td>
|
<td>Show selected file</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><span class="key">r</span></td>
|
||||||
|
<td>Toggle review flag on selected file</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<span class="key modifier">Shift</span>
|
<span class="key modifier">Shift</span>
|
||||||
|
|||||||
Reference in New Issue
Block a user