Bug 1854056 - using bullet in autofill previews instead of * r=mtigley,credential-management-reviewers

Depends on D191355

Differential Revision: https://phabricator.services.mozilla.com/D191360
This commit is contained in:
Sergey Galich 2023-10-31 23:48:19 +00:00
parent 381f3063d4
commit da76d17148
6 changed files with 13 additions and 9 deletions

View file

@ -141,8 +141,8 @@
this.getAttribute("ac-value") this.getAttribute("ac-value")
); );
this._label.textContent = primary; this._label.textContent = primary.toString().replaceAll("*", "•");
this._comment.textContent = secondary; this._comment.textContent = secondary.toString().replaceAll("*", "•");
if (ariaLabel) { if (ariaLabel) {
this.setAttribute("aria-label", ariaLabel); this.setAttribute("aria-label", ariaLabel);
} }

View file

@ -66,7 +66,7 @@ async function checkMultipleCCNumberFormStyle(profile, isPreviewing = true) {
for (const element of elements) { for (const element of elements) {
let fillableValue; let fillableValue;
if (element.id.includes("cc-number") && isPreviewing) { if (element.id.includes("cc-number") && isPreviewing) {
fillableValue = profile["cc-number"].slice(-8); fillableValue = profile["cc-number"].slice(-8).replaceAll("*", "•");
} else if (element.id.includes("cc-number")) { } else if (element.id.includes("cc-number")) {
fillableValue = profile["cc-number"]; fillableValue = profile["cc-number"];
} else { } else {

View file

@ -139,7 +139,8 @@ async function checkFormFieldsStyle(profile, isPreviewing = true) {
previewValue = ""; previewValue = "";
} else { } else {
fillableValue = profile && profile[elem.id]; fillableValue = profile && profile[elem.id];
previewValue = (isPreviewing && fillableValue) || ""; previewValue =
(isPreviewing && fillableValue?.toString().replaceAll("*", "•")) || "";
} }
await checkFieldHighlighted(elem, !!fillableValue); await checkFieldHighlighted(elem, !!fillableValue);
await checkFieldPreview(elem, previewValue); await checkFieldPreview(elem, previewValue);

View file

@ -417,7 +417,11 @@ export class CreditCardResult extends ProfileAutoCompleteResult {
const ccTypeName = ccTypeL10nId const ccTypeName = ccTypeL10nId
? lazy.l10n.formatValueSync(ccTypeL10nId) ? lazy.l10n.formatValueSync(ccTypeL10nId)
: ccType ?? ""; // Unknown card type : ccType ?? ""; // Unknown card type
const ariaLabel = [ccTypeName, primary.toString().replaceAll("*", ""), secondary] const ariaLabel = [
ccTypeName,
primary.toString().replaceAll("*", ""),
secondary,
]
.filter(chunk => !!chunk) // Exclude empty chunks. .filter(chunk => !!chunk) // Exclude empty chunks.
.join(" "); .join(" ");
return { return {

View file

@ -433,7 +433,7 @@ export class FormAutofillSection {
// Skip the field if the user has already entered text and that text is not the site prefilled value. // Skip the field if the user has already entered text and that text is not the site prefilled value.
continue; continue;
} }
element.previewValue = value; element.previewValue = value?.toString().replaceAll("*", "•");
this.handler.changeFieldState( this.handler.changeFieldState(
fieldDetail, fieldDetail,
value ? FIELD_STATES.PREVIEW : FIELD_STATES.NORMAL value ? FIELD_STATES.PREVIEW : FIELD_STATES.NORMAL

View file

@ -138,11 +138,10 @@ async function openRelayAC(browser) {
await openACPopup(popup, browser, "#form-basic-username"); await openACPopup(popup, browser, "#form-basic-username");
const popupItem = document const popupItem = document
.querySelector("richlistitem") .querySelector("richlistitem")
.getAttribute("ac-label"); .getAttribute("ac-value");
const popupItemTitle = JSON.parse(popupItem).title;
Assert.ok( Assert.ok(
gRelayACOptionsTitles.some(title => title.value === popupItemTitle), gRelayACOptionsTitles.some(title => title.value === popupItem),
"AC Popup has an item Relay option shown in popup" "AC Popup has an item Relay option shown in popup"
); );