Skip to content

Commit

Permalink
report: convert v6 emulatedFormFactor to v7 formFactor (#11876)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulirish committed Mar 23, 2021
1 parent 8256b86 commit 5d7e6f9
Showing 1 changed file with 8 additions and 3 deletions.
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
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'
? Util.i18n.strings.runtimeMobileEmulation
: Util.i18n.strings.runtimeDesktopEmulation;
const deviceEmulation = {
mobile: Util.i18n.strings.runtimeMobileEmulation,
desktop: Util.i18n.strings.runtimeDesktopEmulation,
}[settings.formFactor] || Util.i18n.strings.runtimeNoEmulation;

return {
deviceEmulation,
Expand Down

0 comments on commit 5d7e6f9

Please sign in to comment.