Bug 1362584 - Show autofill name fields in the management/preferences UI r=scottwu

MozReview-Commit-ID: 7m3sKGWfERC

--HG--
extra : rebase_source : a74ce933400db1d37a443ce2fa32f9ccc11f4452
This commit is contained in:
Matthew Noorenberghe 2017-05-06 00:04:13 -07:00
Родитель 30ac05ec08
Коммит 6e0c59cbea
5 изменённых файлов: 27 добавлений и 27 удалений

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

@ -16,17 +16,17 @@
</head>
<body>
<form>
<label id="first-name-container">
<label id="given-name-container">
<span>First Name</span>
<input id="first-name" type="text"/>
<input id="given-name" type="text"/>
</label>
<label id="middle-name-container">
<label id="additional-name-container">
<span>Middle Name</span>
<input id="middle-name" type="text"/>
<input id="additional-name" type="text"/>
</label>
<label id="last-name-container">
<label id="family-name-container">
<span>Last Name</span>
<input id="last-name" type="text"/>
<input id="family-name" type="text"/>
</label>
<label id="organization-container">
<span>Company</span>

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

@ -139,6 +139,7 @@ ManageProfileDialog.prototype = {
// as option text. Possibly improve the algorithm in
// ProfileAutoCompleteResult.jsm and reuse it here.
const fieldOrder = [
"name",
"street-address", // Street address
"address-level2", // City/Town
"organization", // Company or organization name
@ -169,7 +170,7 @@ ManageProfileDialog.prototype = {
*/
openEditDialog(profile) {
window.openDialog(EDIT_PROFILE_URL, null,
"chrome,centerscreen,modal,width=600,height=370",
"chrome,centerscreen,modal,width=600,height=450",
profile);
},

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

@ -52,15 +52,15 @@ button {
width: 15em;
}
#first-name-container,
#middle-name-container,
#given-name-container,
#additional-name-container,
#address-level1-container,
#postal-code-container,
#country-container {
flex: 0 1 50%;
}
#last-name-container,
#family-name-container,
#organization-container,
#street-address-container,
#address-level2-container,
@ -74,7 +74,7 @@ button {
justify-content: end;
}
#last-name,
#family-name,
#organization,
#address-level2,
#tel{
@ -86,10 +86,3 @@ button {
#email {
flex: 1 0 auto;
}
#first-name-container,
#middle-name-container,
#last-name-container {
/* Hide until we support names */
display: none;
}

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

@ -29,6 +29,12 @@ add_task(function* test_saveProfile() {
resolve();
}, {once: true});
EventUtils.synthesizeKey("VK_TAB", {}, win);
EventUtils.synthesizeKey(TEST_PROFILE_1["given-name"], {}, win);
EventUtils.synthesizeKey("VK_TAB", {}, win);
EventUtils.synthesizeKey(TEST_PROFILE_1["additional-name"], {}, win);
EventUtils.synthesizeKey("VK_TAB", {}, win);
EventUtils.synthesizeKey(TEST_PROFILE_1["family-name"], {}, win);
EventUtils.synthesizeKey("VK_TAB", {}, win);
EventUtils.synthesizeKey(TEST_PROFILE_1.organization, {}, win);
EventUtils.synthesizeKey("VK_TAB", {}, win);
EventUtils.synthesizeKey(TEST_PROFILE_1["street-address"], {}, win);
@ -46,20 +52,17 @@ add_task(function* test_saveProfile() {
EventUtils.synthesizeKey(TEST_PROFILE_1.tel, {}, win);
EventUtils.synthesizeKey("VK_TAB", {}, win);
EventUtils.synthesizeKey("VK_TAB", {}, win);
info("saving profile");
EventUtils.synthesizeKey("VK_RETURN", {}, win);
}, {once: true});
});
let profiles = yield getProfiles();
is(profiles.length, 1, "only one profile is in storage");
is(profiles[0].organization, TEST_PROFILE_1.organization, "match organization");
is(profiles[0]["street-address"], TEST_PROFILE_1["street-address"], "match street-address");
is(profiles[0]["address-level2"], TEST_PROFILE_1["address-level2"], "match address-level2");
is(profiles[0]["address-level1"], TEST_PROFILE_1["address-level1"], "match address-level1");
is(profiles[0]["postal-code"], TEST_PROFILE_1["postal-code"], "match postal-code");
is(profiles[0].country, TEST_PROFILE_1.country, "match country");
is(profiles[0].email, TEST_PROFILE_1.email, "match email");
is(profiles[0].tel, TEST_PROFILE_1.tel, "match tel");
is(Object.keys(TEST_PROFILE_1).length, 11, "Sanity check number of properties");
for (let [fieldName, fieldValue] of Object.entries(TEST_PROFILE_1)) {
is(profiles[0][fieldName], TEST_PROFILE_1[fieldName], "check " + fieldName);
}
});
add_task(function* test_editProfile() {
@ -79,7 +82,7 @@ add_task(function* test_editProfile() {
profiles = yield getProfiles();
is(profiles.length, 1, "only one profile is in storage");
is(profiles[0].organization, TEST_PROFILE_1.organization + "test", "organization changed");
is(profiles[0]["given-name"], TEST_PROFILE_1["given-name"] + "test", "given-name changed");
yield removeProfiles([profiles[0].guid]);
profiles = yield getProfiles();

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

@ -8,6 +8,9 @@ const MANAGE_PROFILES_DIALOG_URL = "chrome://formautofill/content/manageProfiles
const EDIT_PROFILE_DIALOG_URL = "chrome://formautofill/content/editProfile.xhtml";
const TEST_PROFILE_1 = {
"given-name": "John",
"additional-name": "R.",
"family-name": "Smith",
organization: "World Wide Web Consortium",
"street-address": "32 Vassar Street\nMIT Room 32-G524",
"address-level2": "Cambridge",