report(pwa): remove gauge alias (#13269)

This commit is contained in:
Adam Raine 2021-10-26 16:31:56 -07:00 коммит произвёл GitHub
Родитель 8a67c475c9
Коммит 50ca924316
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 5 добавлений и 15 удалений

Просмотреть файл

@ -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

Просмотреть файл

@ -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 {

Просмотреть файл

@ -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);
@ -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);