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 34d0e24 commit ef57acd
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 @@ -174,7 +174,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 @@ -187,7 +187,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--not-applicable');
notApplicableElem.classList.add('lh-audit-group--not-applicable');
elements.forEach(elem => notApplicableElem.appendChild(elem));
return notApplicableElem;
}
Expand All @@ -201,7 +201,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 @@ -308,20 +308,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 @@ -127,7 +127,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 @@ -158,7 +158,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 @@ -175,7 +175,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 ef57acd

Please sign in to comment.