Skip to content

Commit

Permalink
feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
ebidel committed May 16, 2017
1 parent 3c78046 commit cb16f96
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 33 deletions.
3 changes: 2 additions & 1 deletion lighthouse-core/audits/manual/pwa-cross-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ class PWACrossBrowser extends ManualAudit {
return Object.assign({
category: 'PWA',
name: 'pwa-cross-browser',
helpText: 'To reach the most number of users, sites should work across every major browser.',
helpText: 'To reach the most number of users, sites should work across ' +
'every major browser. [Learn more](https://developers.google.com/web/progressive-web-apps/checklist#site-works-cross-browser).',
description: 'Site works cross-browser',
}, super.meta);
}
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/audits/manual/pwa-each-page-has-url.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class PWAEachPageHasURL extends ManualAudit {
category: 'PWA',
name: 'pwa-each-page-has-url',
helpText: 'Ensure individual pages are deep linkable via the URLs and that URLs are ' +
'unique for the purpose of shareability on social media.',
'unique for the purpose of shareability on social media. [Learn more](https://developers.google.com/web/progressive-web-apps/checklist#each-page-has-a-url).',
description: 'Each page has a URL',
}, super.meta);
}
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/audits/manual/pwa-page-transitions.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class PWAPageTransitions extends ManualAudit {
category: 'PWA',
name: 'pwa-page-transitions',
helpText: 'Transitions should feel snappy as you tap around, even on a slow network, a key ' +
'to perceived performance.',
'to perceived performance. [Learn more](https://developers.google.com/web/progressive-web-apps/checklist#page-transitions-dont-feel-like-they-block-on-the-network).',
description: 'Page transitions don\'t feel like they block on the network',
}, super.meta);
}
Expand Down
6 changes: 3 additions & 3 deletions lighthouse-core/config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -640,17 +640,17 @@ module.exports = {
"description": "Screen readers and other assistive technologies require annotations to understand otherwise ambiguous content."
},
"manual-pwa-checks": {
"title": "¹ Manual checks to verify",
"title": "Manual checks to verify",
"description": "These audits are required by the baseline " +
"[PWA Checklist](https://developers.google.com/web/progressive-web-apps/checklist) but are " +
"not automatically checked by Lighthouse. They do not affect your score but please verify them manually."
"not automatically checked by Lighthouse. They do not affect your score but it's important that you verify them manually."
},
},
"categories": {
"pwa": {
"name": "Progressive Web App",
"weight": 1,
"description": "These audits validate the aspects of a Progressive Web App. They are a subset¹ of the baseline [PWA Checklist](https://developers.google.com/web/progressive-web-apps/checklist).",
"description": "These audits validate the aspects of a Progressive Web App, as specified by the baseline [PWA Checklist](https://developers.google.com/web/progressive-web-apps/checklist).",
"audits": [
{"id": "service-worker", "weight": 1},
{"id": "works-offline", "weight": 1},
Expand Down
53 changes: 31 additions & 22 deletions lighthouse-core/report/v2/renderer/category-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class CategoryRenderer {
scoreEl.classList.add('lh-score--informative');
}
if (audit.result.manual) {
scoreEl.classList.add('lh-score--unknown');
scoreEl.classList.add('lh-score--manual');
}

return this._populateScore(tmpl, audit.score, scoringMode, title, description);
Expand Down Expand Up @@ -216,6 +216,35 @@ class CategoryRenderer {
return passedElem;
}

/**
* @param {!Array<!ReportRenderer.AuditJSON>} manualAudits
* @param {!Object<string, !ReportRenderer.GroupJSON>} groupDefinitions
* @param {!Element} element Parent container to add the manual audits to.
*/
_renderManualAudits(manualAudits, groupDefinitions, element) {
const auditsGroupedByGroup = /** @type {!Object<string,
!Array<!ReportRenderer.AuditJSON>>} */ ({});
manualAudits.forEach(audit => {
const group = auditsGroupedByGroup[audit.group] || [];
group.push(audit);
auditsGroupedByGroup[audit.group] = group;
});

Object.keys(auditsGroupedByGroup).forEach(groupId => {
const group = groupDefinitions[groupId];
const auditGroupElem = this._renderAuditGroup(group);

this._dom.find('.lh-audit-group__summary', auditGroupElem)
.classList.add('lh-audit-group__summary--manual');

auditsGroupedByGroup[groupId].forEach(audit => {
auditGroupElem.appendChild(this._renderAudit(audit));
});

element.appendChild(auditGroupElem);
});
}

/**
* @param {!Document|!Element} context
*/
Expand Down Expand Up @@ -296,27 +325,7 @@ class CategoryRenderer {
}

// Render manual audits after passing.
const auditsGroupedByGroup = /** @type {!Object<string,
!Array<!ReportRenderer.AuditJSON>>} */ ({});
manualAudits.forEach(audit => {
const group = auditsGroupedByGroup[audit.group] || [];
group.push(audit);
auditsGroupedByGroup[audit.group] = group;
});

Object.keys(auditsGroupedByGroup).forEach(groupId => {
const group = groupDefinitions[groupId];
const auditGroupElem = this._renderAuditGroup(group);

this._dom.find('.lh-audit-group__summary', auditGroupElem)
.classList.add('lh-audit-group__summary--manual');

auditsGroupedByGroup[groupId].forEach(audit => {
auditGroupElem.appendChild(this._renderAudit(audit));
});

element.appendChild(auditGroupElem);
});
this._renderManualAudits(manualAudits, groupDefinitions, element);

return element;
}
Expand Down
8 changes: 4 additions & 4 deletions lighthouse-core/report/v2/report-styles.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ describe('CategoryRenderer', () => {
const pwaCategory = sampleResults.reportCategories.find(cat => cat.id === 'pwa');
const categoryDOM = renderer.render(pwaCategory, sampleResults.reportGroups);
assert.ok(categoryDOM.querySelector('.lh-audit-group__summary--manual'));
assert.equal(categoryDOM.querySelectorAll('.lh-score--informative.lh-score--unknown').length, 3,
assert.equal(categoryDOM.querySelectorAll('.lh-score--informative.lh-score--manual').length, 3,
'score shows informative and dash icon');

const perfCategory = sampleResults.reportCategories.find(cat => cat.id === 'performance');
Expand Down

0 comments on commit cb16f96

Please sign in to comment.