Skip to content
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

report(redesign): fireworks #8660

Merged
merged 6 commits into from
May 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 9 additions & 11 deletions lighthouse-core/report/html/renderer/report-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,18 +242,16 @@ class ReportRenderer {
wrapper.appendChild(renderer.render(category, report.categoryGroups));
}

// TODO(hoten) - fireworks show will commence later.
// Fireworks
// const scoresAll100 = report.reportCategories.every(cat => cat.score === 1);
// if (!this._dom.isDevTools() && scoresAll100) {
// if (scoresAll100) {
// const scoresContainer = this._dom.find('.lh-scores-container', headerContainer);
// scoresContainer.classList.add('score100');
// scoresContainer.addEventListener('click', _ => {
// scoresContainer.classList.toggle('fireworks-paused');
// });
// }
// }
const scoresAll100 = report.reportCategories.every(cat => cat.score === 1);
if (!this._dom.isDevTools() && scoresAll100) {
const scoresContainer = this._dom.find('.lh-scores-container', headerContainer);
scoresContainer.classList.add('score100');
this._dom._document.body.classList.add('dark');
scoresContainer.addEventListener('click', _ => {
scoresContainer.classList.toggle('fireworks-paused');
});
}

if (scoreHeader) {
const scoreGauges =
Expand Down
9 changes: 8 additions & 1 deletion lighthouse-core/report/html/templates.html
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,12 @@
}
</style>
<div class="lh-scores-wrapper">
<div class="lh-scores-container"></div>
<div class="lh-scores-container">
<div class="pyro">
<div class="before"></div>
<div class="after"></div>
</div>
</div>
</div>
</template>

Expand Down Expand Up @@ -362,6 +367,8 @@
*/
.pyro {
display: none;
z-index: 1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need pointer-events: none now. it's hard but possible to click on the fireworks div blocking the click on the gauge

pointer-events: none;
}
.score100 .pyro {
display: block;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,7 @@ describe('ReportRenderer', () => {
assert.equal(renderer._templateContext, otherDocument);
});

// Fireworks temporarily canceled. See #8185
test.skip('should render an all 100 report with fireworks', () => {
it('should render an all 100 report with fireworks', () => {
const container = renderer._dom._document.body;

sampleResults.reportCategories.forEach(element => {
Expand All @@ -227,7 +226,7 @@ describe('ReportRenderer', () => {
assert.ok(output.querySelector('.lh-header-sticky'), 'has a header');
assert.ok(output.querySelector('.lh-report'), 'has report body');
assert.equal(output.querySelectorAll('.lh-gauge__wrapper, .lh-gauge--pwa__wrapper').length,
sampleResults.reportCategories.length * 2, 'renders category gauges');
sampleResults.reportCategories.length * 3, 'renders category gauges');
// fireworks!
assert.ok(output.querySelector('.score100'), 'has fireworks treatment');
});
Expand Down