diff --git a/lighthouse-core/audits/audit.js b/lighthouse-core/audits/audit.js index fce625e1e215..6ee2851c18a6 100644 --- a/lighthouse-core/audits/audit.js +++ b/lighthouse-core/audits/audit.js @@ -70,7 +70,7 @@ class Audit { * Table cells will use the type specified in headings[x].itemType. However a custom type * can be provided: results[x].propName = {type: 'code', text: '...'} * @param {!Audit.Headings} headings - * @param {!Array>} results + * @param {!Array>} results * @return {!Array} */ static makeV2TableRows(headings, results) { @@ -157,13 +157,27 @@ class Audit { module.exports = Audit; -/** @typedef {{ - * key: string, - * itemType: string, - * text: string, - * }} +/** @typedef { + * !Array<{ + * key: string, + * itemType: string, + * text: string, + * }>} */ -Audit.Heading; // eslint-disable-line no-unused-expressions - -/** @typedef {!Array} */ Audit.Headings; // eslint-disable-line no-unused-expressions + + +{{results: !Array, headings: !Audit.Headings, passes: boolean, debugString: (string|undefined)}} +{{results: !Array, passes: boolean=, headings: !Audit.Headings, debugString: string=}} +{{results: !Array, headings: !Audit.Headings, passes: boolean, debugString: string=}} +{!{debugString: string=, passes: boolean=, headings: !Audit.Headings, results: !Array>}} result + +/** @typedef { + * {{ + * results: !Array, + * headings: !Audit.Headings, + * passes: boolean, + * debugString: (string|undefined) + * }} + */ + Audit.; // eslint-disable-line no-unused-expressions \ No newline at end of file diff --git a/lighthouse-core/audits/byte-efficiency/offscreen-images.js b/lighthouse-core/audits/byte-efficiency/offscreen-images.js index b3b6907e5b8e..2ea2538f6800 100644 --- a/lighthouse-core/audits/byte-efficiency/offscreen-images.js +++ b/lighthouse-core/audits/byte-efficiency/offscreen-images.js @@ -96,7 +96,7 @@ class OffscreenImages extends ByteEfficiencyAudit { /** * @param {!Artifacts} artifacts - * @return {{results: !Array, headings: !Audit.Headings, debugString: string=}} + * @return {{results: !Array, headings: !Audit.Headings, passes: boolean, debugString: (string|undefined)}} */ static audit_(artifacts) { const images = artifacts.ImageUsage; diff --git a/lighthouse-core/audits/byte-efficiency/uses-optimized-images.js b/lighthouse-core/audits/byte-efficiency/uses-optimized-images.js index bac204a92bc6..4620725b317b 100644 --- a/lighthouse-core/audits/byte-efficiency/uses-optimized-images.js +++ b/lighthouse-core/audits/byte-efficiency/uses-optimized-images.js @@ -63,7 +63,7 @@ class UsesOptimizedImages extends ByteEfficiencyAudit { /** * @param {!Artifacts} artifacts - * @return {{results: !Array, headings: !Audit.Headings, passes: boolean=, debugString: string=}} + * @return {{results: !Array, headings: !Audit.Headings, passes: boolean, debugString: (string|undefined)}} */ static audit_(artifacts) { const images = artifacts.OptimizedImages; diff --git a/lighthouse-core/audits/byte-efficiency/uses-request-compression.js b/lighthouse-core/audits/byte-efficiency/uses-request-compression.js index 2b43cd0fd0b0..3ee0c011a8d8 100644 --- a/lighthouse-core/audits/byte-efficiency/uses-request-compression.js +++ b/lighthouse-core/audits/byte-efficiency/uses-request-compression.js @@ -47,7 +47,7 @@ class ResponsesAreCompressed extends ByteEfficiencyAudit { /** * @param {!Artifacts} artifacts * @param {number} networkThroughput - * @return {{results: !Array, passes: boolean=, headings: !Audit.Headings, debugString: string=}} + * @return {{results: !Array, headings: !Audit.Headings, passes: boolean, debugString: (string|undefined)}} */ static audit_(artifacts) { const uncompressedResponses = artifacts.ResponseCompression; diff --git a/lighthouse-core/audits/byte-efficiency/uses-responsive-images.js b/lighthouse-core/audits/byte-efficiency/uses-responsive-images.js index 9bea788c1e37..71cc894ca410 100644 --- a/lighthouse-core/audits/byte-efficiency/uses-responsive-images.js +++ b/lighthouse-core/audits/byte-efficiency/uses-responsive-images.js @@ -81,7 +81,7 @@ class UsesResponsiveImages extends ByteEfficiencyAudit { /** * @param {!Artifacts} artifacts - * @return {{results: !Array, headings: !Audit.Headings, passes: boolean=, debugString: string=}} + * @return {{results: !Array, headings: !Audit.Headings, passes: boolean, debugString: (string|undefined)}} */ static audit_(artifacts) { const images = artifacts.ImageUsage; diff --git a/lighthouse-core/report/v2/renderer/details-renderer.js b/lighthouse-core/report/v2/renderer/details-renderer.js index 1c8a870e9457..a9469fa5e794 100644 --- a/lighthouse-core/report/v2/renderer/details-renderer.js +++ b/lighthouse-core/report/v2/renderer/details-renderer.js @@ -70,17 +70,19 @@ class DetailsRenderer { } /** + * Create small thumbnail with scaled down image asset. + * If the supplied details doesn't have an image/* mimeType, then an empty span is returned. * @param {!DetailsRenderer.ThumbnailDetails} value * @return {!Element} */ _renderThumbnail(value) { - if (/^image/.test(value.mimeType) === false) { + if (!value.mimeType.startsWith('image/')) { return this._dom.createElement('span'); } const element = this._dom.createElement('img', 'lh-thumbnail'); element.src = value.url; - element.alt = 'Image preview'; + element.alt = ''; element.title = value.url; return element; }