Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

report: convert v6 emulatedFormFactor to v7 formFactor #11876

Merged
merged 4 commits into from
Dec 23, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions lighthouse-core/report/html/renderer/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ class Util {
if (!clone.configSettings.locale) {
clone.configSettings.locale = 'en';
}
if (!clone.configSettings.formFactor) {
// @ts-expect-error fallback handling for emulatedFormFactor
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add a version comment like on the other comments? Someday we won't remember when this change happened :)

clone.configSettings.formFactor = clone.configSettings.emulatedFormFactor;
}

for (const audit of Object.values(clone.audits)) {
// Turn 'not-applicable' (LHR <4.0) and 'not_applicable' (older proto versions)
Expand Down Expand Up @@ -425,9 +429,10 @@ class Util {
}

// TODO(paulirish): revise Runtime Settings strings: https://github.com/GoogleChrome/lighthouse/pull/11796
const deviceEmulation = settings.formFactor === 'mobile'

This comment was marked as resolved.

? Util.i18n.strings.runtimeMobileEmulation
: Util.i18n.strings.runtimeDesktopEmulation;
const deviceEmulation = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fallback case shouldn't ever happen for the 'mobile'|'desktop' type it is today, so probably worth adding a comment about why there's a fallback to runtimeNoEmulation

mobile: Util.i18n.strings.runtimeMobileEmulation,
desktop: Util.i18n.strings.runtimeDesktopEmulation,
}[settings.formFactor] || Util.i18n.strings.runtimeNoEmulation;

return {
deviceEmulation,
Expand Down