Skip to content

Commit 27c6670

Browse files
ktranDevtools-frontend LUCI CQ
authored andcommitted
[GM3Restyling] Update autofill empty states
Before: https://i.imgur.com/f1eIR1x.png Afer: https://i.imgur.com/JHDd61c.png Bug: 325443331 Change-Id: Ic38768bdc097473159be461ca0609a4d42ca64cc Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6276136 Commit-Queue: Kim-Anh Tran <[email protected]> Reviewed-by: Kateryna Prokopenko <[email protected]>
1 parent 0bba616 commit 27c6670

File tree

3 files changed

+27
-11
lines changed

3 files changed

+27
-11
lines changed

front_end/panels/autofill/AutofillView.test.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,13 @@ describeWithMockConnection('AutofillView', () => {
135135
};
136136

137137
it('renders autofilled address and filled fields and clears content on navigation', async () => {
138+
const expectedPlaceholderHeader = 'No autofill detected';
138139
const expectedPlaceholder = 'To start debugging autofill, use Chrome\'s autofill menu to fill an address form.';
139140
const view = await renderAutofillView();
140-
let placeholderText = view.shadowRoot!.querySelector('.placeholder div')!.textContent!.trim();
141+
let placeholderHeader = view.shadowRoot!.querySelector('.empty-state-header')!.textContent!.trim();
142+
assert.strictEqual(placeholderHeader, expectedPlaceholderHeader);
143+
144+
let placeholderText = view.shadowRoot!.querySelector('.empty-state-description > span')!.textContent!.trim();
141145
assert.strictEqual(placeholderText, expectedPlaceholder);
142146

143147
autofillModel.addressFormFilled(addressFormFilledEvent);
@@ -147,7 +151,10 @@ describeWithMockConnection('AutofillView', () => {
147151
navigate(getMainFrame(target));
148152

149153
await RenderCoordinator.done();
150-
placeholderText = view.shadowRoot!.querySelector('.placeholder div')!.textContent!.trim();
154+
placeholderHeader = view.shadowRoot!.querySelector('.empty-state-header')!.textContent!.trim();
155+
assert.strictEqual(placeholderHeader, expectedPlaceholderHeader);
156+
157+
placeholderText = view.shadowRoot!.querySelector('.empty-state-description > span')!.textContent!.trim();
151158
assert.strictEqual(placeholderText, expectedPlaceholder);
152159
});
153160

front_end/panels/autofill/AutofillView.ts

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ import * as AutofillManager from '../../models/autofill_manager/autofill_manager
1414
import * as ComponentHelpers from '../../ui/components/helpers/helpers.js';
1515
import * as Input from '../../ui/components/input/input.js';
1616
import * as LegacyWrapper from '../../ui/components/legacy_wrapper/legacy_wrapper.js';
17+
// inspectorCommonStyles is imported for the empty state styling that is used for the start view
18+
// eslint-disable-next-line rulesdir/es-modules-import
19+
import inspectorCommonStylesRaw from '../../ui/legacy/inspectorCommon.css.js';
1720
import * as Lit from '../../ui/lit/lit.js';
1821
import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
1922

@@ -23,10 +26,18 @@ import autofillViewStylesRaw from './autofillView.css.js';
2326
const autofillViewStyles = new CSSStyleSheet();
2427
autofillViewStyles.replaceSync(autofillViewStylesRaw.cssContent);
2528

29+
// TODO(crbug.com/391381439): Fully migrate off of constructed style sheets.
30+
const inspectorCommonStyles = new CSSStyleSheet();
31+
inspectorCommonStyles.replaceSync(inspectorCommonStylesRaw.cssContent);
32+
2633
const {html, render, Directives: {styleMap}} = Lit;
2734
const {FillingStrategy} = Protocol.Autofill;
2835

2936
const UIStrings = {
37+
/**
38+
* @description Text shown when there is no data on autofill available.
39+
*/
40+
noAutofill: 'No autofill detected',
3041
/**
3142
* @description Explanation for how to populate the autofill panel with data. Shown when there is
3243
* no data available.
@@ -123,7 +134,7 @@ export class AutofillView extends LegacyWrapper.LegacyWrapper.WrappableComponent
123134
}
124135

125136
connectedCallback(): void {
126-
this.#shadow.adoptedStyleSheets = [Input.checkboxStyles, autofillViewStyles];
137+
this.#shadow.adoptedStyleSheets = [Input.checkboxStyles, autofillViewStyles, inspectorCommonStyles];
127138
const autofillManager = AutofillManager.AutofillManager.AutofillManager.instance();
128139
const formFilledEvent = autofillManager.getLastFilledAddressForm();
129140
if (formFilledEvent) {
@@ -192,9 +203,12 @@ export class AutofillView extends LegacyWrapper.LegacyWrapper.WrappableComponent
192203
<x-link href=${AUTOFILL_FEEDBACK_URL} class="feedback link" jslog=${VisualLogging.link('feedback').track({click: true})}>${i18nString(UIStrings.sendFeedback)}</x-link>
193204
</div>
194205
<div class="placeholder-container" jslog=${VisualLogging.pane('autofill-empty')}>
195-
<div class="placeholder">
196-
<div>${i18nString(UIStrings.toStartDebugging)}</div>
197-
<x-link href=${AUTOFILL_INFO_URL} class="link" jslog=${VisualLogging.link('learn-more').track({click: true})}>${i18nString(UIStrings.learnMore)}</x-link>
206+
<div class="empty-state">
207+
<span class="empty-state-header">${i18nString(UIStrings.noAutofill)}</span>
208+
<div class="empty-state-description">
209+
<span>${i18nString(UIStrings.toStartDebugging)}</span>
210+
<x-link href=${AUTOFILL_INFO_URL} class="link" jslog=${VisualLogging.link('learn-more').track({click: true})}>${i18nString(UIStrings.learnMore)}</x-link>
211+
</div>
198212
</div>
199213
</div>
200214
</main>

front_end/panels/autofill/autofillView.css

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,6 @@ main {
2121
align-items: center;
2222
}
2323

24-
.placeholder {
25-
font-size: 15px;
26-
text-align: center;
27-
}
28-
2924
.address {
3025
padding: 10px;
3126
margin-right: auto;

0 commit comments

Comments
 (0)