-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
core: change 'not-applicable' to 'notApplicable' #6783
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems fine to me, but with these it's always what we missed not what we see haha 🤷♂️
the back compat of the renderer most important to nail IMO, so 👍
@@ -124,7 +124,7 @@ declare global { | |||
warnings?: string[]; | |||
score?: number; | |||
extendedInfo?: {[p: string]: any}; | |||
/** Overrides scoreDisplayMode with not-applicable if set to true */ | |||
/** Overrides scoreDisplayMode with notApplicable if set to true */ | |||
notApplicable?: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a head of its time 😆
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looking good (good thing we didn't push 4.0 yet!), but need to do a global search for some more instances of not-applicable
. I highlighted a couple here, but there are a few more in e.g. html and etc
@@ -56,7 +56,7 @@ class CategoryRenderer { | |||
title: Util.UIStrings.passedAuditsGroupTitle, | |||
className: 'lh-clump--passed', | |||
}, | |||
'not-applicable': { | |||
'notApplicable': { | |||
title: Util.UIStrings.notApplicableAuditsGroupTitle, | |||
className: 'lh-clump--not-applicable', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to update
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh we should get a puppeteer screenshot test in for the report to catch these css mismatches
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh we should get a puppeteer screenshot test in for the report to catch these css mismatches
good idea. Don't we also have a jsdom test or two looking for the not applicable results? Concerning they weren't found...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concerning they weren't found...
oh, because the test selectors weren't updated either :)
But now I'm questioning if it should be updated :) We don't currently create the clump names dynamically, so it can be whatever we want. Commonly notApplicable
in js goes to not-applicable
in css, but do we care? Or is notapplicable
fine? Keeping camelCase seems gross, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would go for not-applicable makes it easier to read in my opinion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also update not-applicable
in comments in pwa-category-renderer.js
and category-renderer.js
and in docs in understanding-results.md
@@ -124,7 +124,7 @@ declare global { | |||
warnings?: string[]; | |||
score?: number; | |||
extendedInfo?: {[p: string]: any}; | |||
/** Overrides scoreDisplayMode with not-applicable if set to true */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also should be notApplicable
in the comment ~20 lines below here
…audit class to .lh-audit--notapplicable
…in other tests. Added missing SDM test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol ctrl-shift-f
"not-applicable". I think there are four more at least.
@@ -153,7 +153,10 @@ class CategoryRenderer { | |||
*/ | |||
_setRatingClass(element, score, scoreDisplayMode) { | |||
const rating = Util.calculateRating(score, scoreDisplayMode); | |||
element.classList.add(`lh-audit--${rating}`, `lh-audit--${scoreDisplayMode}`); | |||
element.classList.add(`lh-audit--${rating}`); | |||
if (typeof scoreDisplayMode === 'string') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wait...how would it be possible for it not to be? That seems bad if it happens. Just in tests maybe (hopefully)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from https://travis-ci.org/GoogleChrome/lighthouse/builds/470305380#L816, it looks like just the unit tests. We should fix those (is that what fdf9755 did?) and then not change the code here, I think. Better to trust our type system and fail fast if we defined/enforced things poorly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah fdf9755 fixed the unit tests and added guard rails for if the scoreDisplayMode was undefined. Good point tho, I removed the guardrails and made all the tests actually represent reality!
@@ -78,7 +78,7 @@ describe('processing for proto', () => { | |||
const input = { | |||
'audits': { | |||
'critical-request-chains': { | |||
'scoreDisplayMode': 'not-applicable', | |||
'scoreDisplayMode': 'notApplicable', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ha, sorry, this one we want
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete not-applicable
don't delete not-applicable
I just can't impress you brendan 😭
💥 |
Summary
Change not-applicable to notApplicable. This will allow the LHR and protoLHR to use to same value instead of converting it in preprocessing.
Unfortunately since we can't ignore old LHRs that use 'not-applicable' or 'not_applicable' the processors, proto, and renderer need to accommodate those values.
Related Issues/PRs
fixes: #6201