Skip to content

Commit

Permalink
by default, audit groups are adorned.
Browse files Browse the repository at this point in the history
  • Loading branch information
paulirish committed May 7, 2018
1 parent cc5434b commit 0eb3c89
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
9 changes: 6 additions & 3 deletions lighthouse-core/report/html/renderer/category-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ class CategoryRenderer {
const passedElem = this.renderAuditGroup({
title: `Passed audits`,
}, {expandable: true, itemCount: this._getTotalAuditsLength(elements)});
passedElem.classList.add('lh-audit-group--adorned', 'lh-passed-audits');
passedElem.classList.add('lh-passed-audits');
elements.forEach(elem => passedElem.appendChild(elem));
return passedElem;
}
Expand All @@ -190,7 +190,7 @@ class CategoryRenderer {
const notApplicableElem = this.renderAuditGroup({
title: `Not applicable`,
}, {expandable: true, itemCount: this._getTotalAuditsLength(elements)});
notApplicableElem.classList.add('lh-audit-group--adorned', 'lh-audit-group--notapplicable');
notApplicableElem.classList.add('lh-audit-group--notapplicable');
elements.forEach(elem => notApplicableElem.appendChild(elem));
return notApplicableElem;
}
Expand All @@ -204,7 +204,7 @@ class CategoryRenderer {
const group = {title: 'Additional items to manually check', description: manualDescription};
const auditGroupElem = this.renderAuditGroup(group,
{expandable: true, itemCount: manualAudits.length});
auditGroupElem.classList.add('lh-audit-group--adorned', 'lh-audit-group--manual');
auditGroupElem.classList.add('lh-audit-group--manual');
manualAudits.forEach((audit, i) => {
auditGroupElem.appendChild(this.renderAudit(audit, i));
});
Expand Down Expand Up @@ -303,20 +303,23 @@ class CategoryRenderer {
if (groups.failed.length) {
const auditGroupElem = this.renderAuditGroup(group, {expandable: false});
groups.failed.forEach((item, i) => auditGroupElem.appendChild(this.renderAudit(item, i)));
auditGroupElem.classList.add('lh-audit-group--unadorned');
auditGroupElem.open = true;
failedElements.push(auditGroupElem);
}

if (groups.passed.length) {
const auditGroupElem = this.renderAuditGroup(group, {expandable: true});
groups.passed.forEach((item, i) => auditGroupElem.appendChild(this.renderAudit(item, i)));
auditGroupElem.classList.add('lh-audit-group--unadorned');
passedElements.push(auditGroupElem);
}

if (groups.notApplicable.length) {
const auditGroupElem = this.renderAuditGroup(group, {expandable: true});
groups.notApplicable.forEach((item, i) =>
auditGroupElem.appendChild(this.renderAudit(item, i)));
auditGroupElem.classList.add('lh-audit-group--unadorned');
notApplicableElements.push(auditGroupElem);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class PerformanceCategoryRenderer extends CategoryRenderer {
estValuesEl.textContent = 'Values are estimated and may vary.';

metricAuditsEl.open = true;
metricAuditsEl.classList.add('lh-audit-group--adorned', 'lh-audit-group--metrics');
metricAuditsEl.classList.add('lh-audit-group--metrics');
element.appendChild(metricAuditsEl);

// Filmstrip
Expand Down Expand Up @@ -160,7 +160,7 @@ class PerformanceCategoryRenderer extends CategoryRenderer {
opportunityAudits.forEach((item, i) =>
groupEl.appendChild(this._renderOpportunity(item, i, scale)));
groupEl.open = true;
groupEl.classList.add('lh-audit-group--adorned', 'lh-audit-group--opportunities');
groupEl.classList.add('lh-audit-group--opportunities');
element.appendChild(groupEl);
}

Expand All @@ -177,7 +177,7 @@ class PerformanceCategoryRenderer extends CategoryRenderer {
const groupEl = this.renderAuditGroup(groups['diagnostics'], {expandable: false});
diagnosticAudits.forEach((item, i) => groupEl.appendChild(this.renderAudit(item, i)));
groupEl.open = true;
groupEl.classList.add('lh-audit-group--adorned', 'lh-audit-group--diagnostics');
groupEl.classList.add('lh-audit-group--diagnostics');
element.appendChild(groupEl);
}

Expand Down
15 changes: 8 additions & 7 deletions lighthouse-core/report/html/report-styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -592,11 +592,7 @@
font-weight: bold;
}

.lh-audit-group--adorned .lh-audit-group__summary + .lh-audit-group__description {
margin-top: var(--lh-audit-group-vpadding);
}

.lh-audit-group--adorned .lh-audit-group__header::before {
.lh-audit-group__header::before {
content: '';
width: calc(var(--subheader-font-size) / 14 * 24);
height: calc(var(--subheader-font-size) / 14 * 24);
Expand All @@ -608,10 +604,11 @@
}

/* A11y/Seo groups within Passed don't get an icon */
.lh-audit-group:not(.lh-audit-group--adorned) .lh-audit-group__header::before {
.lh-audit-group--unadorned .lh-audit-group__header::before {
content: none;
}


.lh-audit-group--manual .lh-audit-group__header::before {
background-image: var(--search-icon-url);
}
Expand Down Expand Up @@ -655,7 +652,11 @@
.lh-audit-group__description {
font-size: var(--body-font-size);
color: var(--medium-75-gray);
margin-bottom: var(--lh-audit-group-vpadding);
margin: var(--lh-audit-group-vpadding) 0;
}

.lh-audit-group--unadorned .lh-audit-group__description {
margin-top: 0;
}


Expand Down

0 comments on commit 0eb3c89

Please sign in to comment.