Skip to content

Commit

Permalink
feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickhulce committed Jan 26, 2017
1 parent bb34ed6 commit c50337d
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
3 changes: 2 additions & 1 deletion lighthouse-core/audits/dobetterweb/uses-optimized-images.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ class UsesOptimizedImages extends Audit {
let displayValue = '';
if (totalWastedBytes > 1000) {
const totalWastedKb = Math.round(totalWastedBytes / KB_IN_BYTES);
const totalWastedMs = Math.round(totalWastedBytes / networkThroughput * 1000);
// Only round to nearest 10ms since we're relatively hand-wavy
const totalWastedMs = Math.round(totalWastedBytes / networkThroughput * 100) * 10;
displayValue = `${totalWastedKb}KB (~${totalWastedMs}ms) potential savings`;
}

Expand Down
3 changes: 2 additions & 1 deletion lighthouse-core/audits/dobetterweb/uses-responsive-images.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ class UsesResponsiveImages extends Audit {
let displayValue;
if (results.length) {
const totalWastedKB = Math.round(totalWastedBytes / KB_IN_BYTES);
const totalWastedMs = Math.round(totalWastedBytes / networkThroughput * 1000);
// Only round to nearest 10ms since we're relatively hand-wavy
const totalWastedMs = Math.round(totalWastedBytes / networkThroughput * 100) * 10;
displayValue = `${totalWastedKB}KB (~${totalWastedMs}ms) potential savings`;
}

Expand Down
6 changes: 3 additions & 3 deletions lighthouse-core/audits/unused-css-rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,7 @@ class UnusedCSSRules extends Audit {
let url = stylesheetInfo.header.sourceURL;
if (!url || url === pageUrl) {
const contentPreview = UnusedCSSRules.determineContentPreview(stylesheetInfo.content);
// two spaces before the newline to trigger a line break
url = 'inline \n`' + contentPreview + '`';
url = '*inline*```' + contentPreview + '```';
} else {
url = URL.getDisplayName(url);
}
Expand Down Expand Up @@ -203,7 +202,8 @@ class UnusedCSSRules extends Audit {
let displayValue = '';
if (unused > 0) {
const wastedKb = Math.round(wastedBytes / KB_IN_BYTES);
const wastedMs = Math.round(wastedBytes / networkThroughput * 1000);
// Only round to nearest 10ms since we're relatively hand-wavy
const wastedMs = Math.round(wastedBytes / networkThroughput * 100) * 10;
displayValue = `${wastedKb}KB (~${wastedMs}ms) potential savings`;
}

Expand Down
10 changes: 4 additions & 6 deletions lighthouse-core/formatters/partials/table.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,14 @@
.table_list tr:hover {
background-color: #fafafa;
}
.table_list td * {
.table_list code, .table_list pre {
display: block;
}
.table_list br + code {
margin-top: 10px;
}
.table_list code {
white-space: pre;
font-family: monospace;
}
.table_list em + code, .table_list em + pre {
margin-top: 10px;
}

.table_list.multicolumn {
display: flex;
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/report/report-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class ReportGenerator {
// XSS, define a renderer that only transforms links and code snippets.
// All other markdown ad HTML is ignored.
const renderer = new marked.Renderer();
renderer.br = () => '<br>';
renderer.em = str => `<em>${str}</em>`;
renderer.link = (href, title, text) => {
title = title || text;
return `<a href="${href}" target="_blank" rel="noopener" title="${title}">${text}</a>`;
Expand Down
4 changes: 2 additions & 2 deletions lighthouse-core/test/audits/unused-css-rules-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ describe('Best Practices: unused css rules audit', () => {
});

it('correctly computes url', () => {
assert.equal(map({header: {sourceURL: ''}}).url, 'inline \n`dummy`');
assert.equal(map({header: {sourceURL: 'a'}}, 'http://g.co/a').url, 'inline \n`dummy`');
assert.equal(map({header: {sourceURL: ''}}).url, '*inline*```dummy```');
assert.equal(map({header: {sourceURL: 'a'}}, 'http://g.co/a').url, '*inline*```dummy```');
assert.equal(map({header: {sourceURL: 'foobar'}}).url, '/foobar');
});

Expand Down

0 comments on commit c50337d

Please sign in to comment.