Skip to content

Commit

Permalink
core: dont show zero ms savings in preconnect, preload audits (#5983)
Browse files Browse the repository at this point in the history
  • Loading branch information
midzer authored and brendankenny committed Sep 7, 2018
1 parent 44dcc5d commit 3424dbc
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 24 deletions.
4 changes: 3 additions & 1 deletion lighthouse-core/audits/uses-rel-preconnect.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,9 @@ class UsesRelPreconnectAudit extends Audit {
return {
score: UnusedBytes.scoreForWastedMs(maxWasted),
rawValue: maxWasted,
displayValue: str_(i18n.UIStrings.displayValueMsSavings, {wastedMs: maxWasted}),
displayValue: maxWasted ?
str_(i18n.UIStrings.displayValueMsSavings, {wastedMs: maxWasted}) :
'',
extendedInfo: {
value: results,
},
Expand Down
4 changes: 3 additions & 1 deletion lighthouse-core/audits/uses-rel-preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,9 @@ class UsesRelPreloadAudit extends Audit {
return {
score: UnusedBytes.scoreForWastedMs(wastedMs),
rawValue: wastedMs,
displayValue: str_(i18n.UIStrings.displayValueMsSavings, {wastedMs}),
displayValue: wastedMs ?
str_(i18n.UIStrings.displayValueMsSavings, {wastedMs}) :
'',
extendedInfo: {
value: results,
},
Expand Down
32 changes: 10 additions & 22 deletions lighthouse-core/test/results/sample_v2.json
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@
"score": 1,
"scoreDisplayMode": "numeric",
"rawValue": 0,
"displayValue": "Potential savings of 0 ms",
"displayValue": "",
"details": {
"type": "opportunity",
"headings": [],
Expand All @@ -783,7 +783,7 @@
"score": 1,
"scoreDisplayMode": "numeric",
"rawValue": 0,
"displayValue": "Potential savings of 0 ms",
"displayValue": "",
"details": {
"type": "opportunity",
"headings": [],
Expand Down Expand Up @@ -3595,26 +3595,6 @@
"lighthouse-core/audits/uses-rel-preload.js | description": [
"audits[uses-rel-preload].description"
],
"lighthouse-core/lib/i18n.js | displayValueMsSavings": [
{
"values": {
"wastedMs": 0
},
"path": "audits[uses-rel-preload].displayValue"
},
{
"values": {
"wastedMs": 0
},
"path": "audits[uses-rel-preconnect].displayValue"
},
{
"values": {
"wastedMs": 1129
},
"path": "audits[render-blocking-resources].displayValue"
}
],
"lighthouse-core/audits/uses-rel-preconnect.js | title": [
"audits[uses-rel-preconnect].title"
],
Expand Down Expand Up @@ -3678,6 +3658,14 @@
"lighthouse-core/audits/byte-efficiency/render-blocking-resources.js | description": [
"audits[render-blocking-resources].description"
],
"lighthouse-core/lib/i18n.js | displayValueMsSavings": [
{
"values": {
"wastedMs": 1129
},
"path": "audits[render-blocking-resources].displayValue"
}
],
"lighthouse-core/lib/i18n.js | columnWastedMs": [
"audits[render-blocking-resources].details.headings[2].label"
],
Expand Down

0 comments on commit 3424dbc

Please sign in to comment.