Bug 1455087 - Support deleting autofill records with the delete key. r=MattN

MozReview-Commit-ID: FiqauWe5oDh

--HG--
extra : rebase_source : bb09a2885d0fc3c3fbb467a9f5c33964cde5fe2c
This commit is contained in:
mbkupfer 2018-04-19 13:06:59 -07:00
Родитель 77ced16df4
Коммит b352ec670b
3 изменённых файлов: 37 добавлений и 0 удалений

Просмотреть файл

@ -237,6 +237,9 @@ class ManageRecords {
if (event.keyCode == KeyEvent.DOM_VK_ESCAPE) {
window.close();
}
if (event.keyCode == KeyEvent.DOM_VK_DELETE) {
this.removeRecords(this._selectedOptions);
}
}
observe(subject, topic, data) {

Просмотреть файл

@ -67,6 +67,23 @@ add_task(async function test_removingSingleAndMultipleAddresses() {
win.close();
});
add_task(async function test_removingAdressViaKeyboardDelete() {
await saveAddress(TEST_ADDRESS_1);
let win = window.openDialog(MANAGE_ADDRESSES_DIALOG_URL, null, DIALOG_SIZE);
await waitForFocusAndFormReady(win);
let selRecords = win.document.querySelector(TEST_SELECTORS.selRecords);
is(selRecords.length, 1, "One address");
EventUtils.synthesizeMouseAtCenter(selRecords.children[0], {}, win);
EventUtils.synthesizeKey("VK_DELETE", {}, win);
await BrowserTestUtils.waitForEvent(selRecords, "RecordsRemoved");
is(selRecords.length, 0, "No addresses left");
win.close();
});
add_task(async function test_addressesDialogWatchesStorageChanges() {
let win = window.openDialog(MANAGE_ADDRESSES_DIALOG_URL, null, DIALOG_SIZE);
await waitForFocusAndFormReady(win);

Просмотреть файл

@ -74,6 +74,23 @@ add_task(async function test_removingSingleAndMultipleCreditCards() {
win.close();
});
add_task(async function test_removingCreditCardsViaKeyboardDelete() {
await saveCreditCard(TEST_CREDIT_CARD_1);
let win = window.openDialog(MANAGE_CREDIT_CARDS_DIALOG_URL, null, DIALOG_SIZE);
await waitForFocusAndFormReady(win);
let selRecords = win.document.querySelector(TEST_SELECTORS.selRecords);
is(selRecords.length, 1, "One credit card");
EventUtils.synthesizeMouseAtCenter(selRecords.children[0], {}, win);
EventUtils.synthesizeKey("VK_DELETE", {}, win);
await BrowserTestUtils.waitForEvent(selRecords, "RecordsRemoved");
is(selRecords.length, 0, "No credit cards left");
win.close();
});
add_task(async function test_creditCardsDialogWatchesStorageChanges() {
let win = window.openDialog(MANAGE_CREDIT_CARDS_DIALOG_URL, null, DIALOG_SIZE);
await waitForFocusAndFormReady(win);