Skip to content

Commit

Permalink
report(pwa): remove gauge alias (#13269)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamraine authored Oct 26, 2021
1 parent 8a67c47 commit 50ca924
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 15 deletions.
10 changes: 0 additions & 10 deletions report/renderer/pwa-category-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,6 @@ export class PwaCategoryRenderer extends CategoryRenderer {
return categoryElem;
}

/**
* Alias for backcompat.
* @param {LH.ReportResult.Category} category
* @param {Record<string, LH.Result.ReportGroup>} groupDefinitions
* @return {DocumentFragment}
*/
renderScoreGauge(category, groupDefinitions) {
return this.renderCategoryScore(category, groupDefinitions);
}

/**
* @param {LH.ReportResult.Category} category
* @param {Record<string, LH.Result.ReportGroup>} groupDefinitions
Expand Down
2 changes: 1 addition & 1 deletion report/renderer/report-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ export class ReportRenderer {
// The renderer for default categories is just the default CategoryRenderer.
// If the functions are equal, then renderer is an instance of CategoryRenderer.
// For example, the PWA category uses PwaCategoryRenderer, which overrides
// CategoryRenderer.renderScoreGauge, so it would fail this check and be placed
// CategoryRenderer.renderCategoryScore, so it would fail this check and be placed
// in the customGauges bucket.
defaultGauges.push(categoryGauge);
} else {
Expand Down
8 changes: 4 additions & 4 deletions report/test/renderer/pwa-category-renderer-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,10 +249,10 @@ describe('PwaCategoryRenderer', () => {
});
});

describe('#renderScoreGauge', () => {
describe('#renderCategoryScore', () => {
it('renders an error score gauge in case of category error', () => {
category.score = null;
const badgeGauge = pwaRenderer.renderScoreGauge(category, sampleResults.categoryGroups);
const badgeGauge = pwaRenderer.renderCategoryScore(category, sampleResults.categoryGroups);

// Not a PWA gauge.
assert.strictEqual(badgeGauge.querySelector('.lh-gauge--pwa__wrapper'), null);
Expand All @@ -263,11 +263,11 @@ describe('PwaCategoryRenderer', () => {
});

it('renders score gauges with unique ids for items in <defs>', () => {
const gauge1 = pwaRenderer.renderScoreGauge(category, sampleResults.categoryGroups);
const gauge1 = pwaRenderer.renderCategoryScore(category, sampleResults.categoryGroups);
const gauge1Ids = [...gauge1.querySelectorAll('defs [id]')].map(el => el.id);
assert.ok(gauge1Ids.length > 2);

const gauge2 = pwaRenderer.renderScoreGauge(category, sampleResults.categoryGroups);
const gauge2 = pwaRenderer.renderCategoryScore(category, sampleResults.categoryGroups);
const gauge2Ids = [...gauge2.querySelectorAll('defs [id]')].map(el => el.id);
assert.ok(gauge2Ids.length === gauge1Ids.length);

Expand Down

0 comments on commit 50ca924

Please sign in to comment.