From 7469c0283fc74425157778bb0cfc870c63e77ad2 Mon Sep 17 00:00:00 2001 From: "Alex N. Jose" Date: Wed, 27 Jul 2022 13:44:42 -0700 Subject: [PATCH 1/5] core(apple-touch-icon): deprecate apple-touch-icon audit. --- lighthouse-core/audits/apple-touch-icon.js | 72 -------------- .../test/audits/apple-touch-icon-test.js | 95 ------------------- shared/localization/locales/ar-XB.json | 12 --- shared/localization/locales/ar.json | 12 --- shared/localization/locales/bg.json | 12 --- shared/localization/locales/ca.json | 12 --- shared/localization/locales/cs.json | 12 --- shared/localization/locales/da.json | 12 --- shared/localization/locales/de.json | 12 --- shared/localization/locales/el.json | 12 --- shared/localization/locales/en-GB.json | 12 --- shared/localization/locales/en-US.json | 12 --- shared/localization/locales/en-XA.json | 12 --- shared/localization/locales/en-XL.json | 12 --- shared/localization/locales/es-419.json | 12 --- shared/localization/locales/es.json | 12 --- shared/localization/locales/fi.json | 12 --- shared/localization/locales/fil.json | 12 --- shared/localization/locales/fr.json | 12 --- shared/localization/locales/he.json | 12 --- shared/localization/locales/hi.json | 12 --- shared/localization/locales/hr.json | 12 --- shared/localization/locales/hu.json | 12 --- shared/localization/locales/id.json | 12 --- shared/localization/locales/it.json | 12 --- shared/localization/locales/ja.json | 12 --- shared/localization/locales/ko.json | 12 --- shared/localization/locales/lt.json | 12 --- shared/localization/locales/lv.json | 12 --- shared/localization/locales/nl.json | 12 --- shared/localization/locales/no.json | 12 --- shared/localization/locales/pl.json | 12 --- shared/localization/locales/pt-PT.json | 12 --- shared/localization/locales/pt.json | 12 --- shared/localization/locales/ro.json | 12 --- shared/localization/locales/ru.json | 12 --- shared/localization/locales/sk.json | 12 --- shared/localization/locales/sl.json | 12 --- shared/localization/locales/sr-Latn.json | 12 --- shared/localization/locales/sr.json | 12 --- shared/localization/locales/sv.json | 12 --- shared/localization/locales/ta.json | 12 --- shared/localization/locales/te.json | 12 --- shared/localization/locales/th.json | 12 --- shared/localization/locales/tr.json | 12 --- shared/localization/locales/uk.json | 12 --- shared/localization/locales/vi.json | 12 --- shared/localization/locales/zh-HK.json | 12 --- shared/localization/locales/zh-TW.json | 12 --- shared/localization/locales/zh.json | 12 --- 50 files changed, 743 deletions(-) delete mode 100644 lighthouse-core/audits/apple-touch-icon.js delete mode 100644 lighthouse-core/test/audits/apple-touch-icon-test.js diff --git a/lighthouse-core/audits/apple-touch-icon.js b/lighthouse-core/audits/apple-touch-icon.js deleted file mode 100644 index c9ca8d56d33e..000000000000 --- a/lighthouse-core/audits/apple-touch-icon.js +++ /dev/null @@ -1,72 +0,0 @@ -/** - * @license Copyright 2019 The Lighthouse Authors. All Rights Reserved. - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. - */ -'use strict'; - -import {Audit} from './audit.js'; -import * as i18n from '../lib/i18n/i18n.js'; - -/** - * @fileoverview Audits if a page has an `apple-touch-icon` link element with a valid href. - */ - -const UIStrings = { - /** Title of a Lighthouse audit that tells the user that their site contains a vaild touch icon. This descriptive title is shown when the page contains a valid iOS touch icon. "apple-touch-icon" is an HTML attribute value and should not be translated. */ - title: 'Provides a valid `apple-touch-icon`', - /** Title of a Lighthouse audit that tells the user that their site contains a vaild touch icon. This descriptive title is shown when the page does not contain a valid iOS touch icon. "apple-touch-icon" is an HTML attribute value and should not be translated. */ - failureTitle: 'Does not provide a valid `apple-touch-icon`', - /** Description of a Lighthouse audit that tells the user that having an apple-touch-icon allows websites to include an app icon to their installed progressive web apps, similar to a native app. This is displayed after a user expands the section to see more. No character length limits. 'Learn More' becomes link text to additional documentation. "apple-touch-icon" is an HTML attribute value and should not be translated. */ - description: 'For ideal appearance on iOS when users add a progressive web app to the home ' + - 'screen, define an `apple-touch-icon`. It must point to a non-transparent 192px (or 180px) ' + - 'square PNG. [Learn more about `apple-touch-icon`](https://web.dev/apple-touch-icon/).', - /** Warning that HTML attribute `apple-touch-icon-precomposed` should not be used in favor of `apple-touch-icon`. "apple-touch-icon-precomposed" and "apple-touch-icon" are HTML attribute values and should not be translated. */ - precomposedWarning: '`apple-touch-icon-precomposed` is out of date; ' + - '`apple-touch-icon` is preferred.', -}; - -const str_ = i18n.createMessageInstanceIdFn(import.meta.url, UIStrings); - -class AppleTouchIcon extends Audit { - /** - * @return {LH.Audit.Meta} - */ - static get meta() { - return { - id: 'apple-touch-icon', - title: str_(UIStrings.title), - failureTitle: str_(UIStrings.failureTitle), - description: str_(UIStrings.description), - supportedModes: ['navigation'], - requiredArtifacts: ['LinkElements'], - }; - } - - /** - * @param {LH.Artifacts} artifacts - * @return {LH.Audit.Product} - */ - static audit(artifacts) { - const appleTouchIcons = artifacts.LinkElements - .filter(el => el.rel === 'apple-touch-icon' || el.rel === 'apple-touch-icon-precomposed') - .filter(el => !!el.href); - - // Audit passes if an `apple-touch-icon` exists. - const passed = appleTouchIcons.length !== 0; - - const warnings = []; - if (appleTouchIcons.filter(el => el.rel === 'apple-touch-icon-precomposed').length !== 0 && - appleTouchIcons.filter(el => el.rel === 'apple-touch-icon').length === 0) { - warnings.push(str_(UIStrings.precomposedWarning)); - } - - return { - score: passed ? 1 : 0, - warnings, - }; - } -} - -export default AppleTouchIcon; -export {UIStrings}; diff --git a/lighthouse-core/test/audits/apple-touch-icon-test.js b/lighthouse-core/test/audits/apple-touch-icon-test.js deleted file mode 100644 index 7f533408ab2c..000000000000 --- a/lighthouse-core/test/audits/apple-touch-icon-test.js +++ /dev/null @@ -1,95 +0,0 @@ -/** - * @license Copyright 2019 The Lighthouse Authors. All Rights Reserved. - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. - */ - -import AppleTouchIcon from '../../audits/apple-touch-icon.js'; - -describe('PWA: apple-touch-icon audit', () => { - it(`fails when apple-touch-icon is not present`, () => { - const artifacts = { - LinkElements: [ - {rel: 'iOS-touch-thing', href: 'https://example.com/else.png'}, - {rel: 'something else', href: 'https://example.com/else.png'}, - ], - }; - - const {score} = AppleTouchIcon.audit(artifacts); - - expect(score).toBe(0); - }); - - it(`fails when apple-touch-icon does not have an href`, () => { - const artifacts = { - LinkElements: [{rel: 'apple-touch-icon'}], - }; - - const {score} = AppleTouchIcon.audit(artifacts); - - expect(score).toBe(0); - }); - - it(`passes but warns when apple-touch-icon-precomposed only`, () => { - const artifacts = { - LinkElements: [{rel: 'apple-touch-icon-precomposed', href: 'https://example.com/touch-icon.png'}], - }; - - const {score, warnings} = AppleTouchIcon.audit(artifacts); - - expect(score).toBe(1); - expect(warnings[0]).toBeDisplayString('`apple-touch-icon-precomposed` is ' + - 'out of date; `apple-touch-icon` is preferred.'); - }); - - it(`passes with no warning when precomposed with normal`, () => { - const artifacts = { - LinkElements: [ - {rel: 'apple-touch-icon', href: 'https://example.com/touch-icon.png'}, - {rel: 'apple-touch-icon-precomposed', href: 'https://example.com/touch-icon.png'}, - ], - }; - - const {score, warnings} = AppleTouchIcon.audit(artifacts); - - expect(score).toBe(1); - expect(warnings).toEqual([]); - }); - - it(`passes when apple-touch-icon is on page`, () => { - const artifacts = { - LinkElements: [{rel: 'apple-touch-icon', href: 'https://example.com/touch-icon.png'}], - }; - - const {score} = AppleTouchIcon.audit(artifacts); - - expect(score).toBe(1); - }); - - it(`passes with multiple apple-touch-icons on page`, () => { - const artifacts = { - LinkElements: [ - {rel: 'apple-touch-icon', sizes: '152x152', href: 'https://example.com/touch-icon.png'}, - {rel: 'apple-touch-icon', sizes: '180x180', href: 'https://example.com/touch-icon.png'}, - ], - }; - - const {score} = AppleTouchIcon.audit(artifacts); - - expect(score).toBe(1); - }); - - it(`passes when lots of LinkElements`, () => { - const artifacts = { - LinkElements: [ - {rel: 'iOS-touch-thing', href: 'https://example.com/else.png'}, - {rel: 'apple-touch-icon', href: 'https://example.com/touch-icon.png'}, - {rel: 'something else', href: 'https://example.com/else.png'}, - ], - }; - - const {score} = AppleTouchIcon.audit(artifacts); - - expect(score).toBe(1); - }); -}); diff --git a/shared/localization/locales/ar-XB.json b/shared/localization/locales/ar-XB.json index 69565d45bdf8..4e0ad3b97524 100644 --- a/shared/localization/locales/ar-XB.json +++ b/shared/localization/locales/ar-XB.json @@ -530,18 +530,6 @@ "lighthouse-core/audits/accessibility/video-caption.js | title": { "message": "`