Skip to content
This repository was archived by the owner on Jan 14, 2022. It is now read-only.

Commit ab16009

Browse files
committed
validations change to ignore shortcut entries and images.
1 parent 53568d0 commit ab16009

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

lib/validations.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,21 @@ function isExpectedValidationError(errorResult) {
4343

4444
function isExpectedCase(errorResult, w3cManifestInfo) {
4545
const errorParams = errorResult.member.split('/').slice(1) //example: /icons/0/purpose -> ['icons', '0', 'purpose']
46-
const isIconsPurpose = errorResult.member.includes("icons") && errorResult.member.includes("purpose")
46+
const isIconsPurpose = errorResult.member.includes("icons") && errorResult.member.includes("purpose");
47+
const isShortcuts = errorResult.member.includes("shortcuts");
48+
const isScreenshots = errorResult.member.includes("screenshots"); // in the case we need to extend it to screenshots as well...
4749

48-
if (isIconsPurpose) {
50+
if ((isScreenshots || isShortcuts) && isIconsPurpose) {
51+
// don't handle, just let it go through
52+
return true;
53+
54+
} else if (isIconsPurpose) {
4955
const [icons, index, purpose] = errorParams
5056

51-
return w3cManifestInfo.content[icons][index][purpose].split(" ").filter(entry => {
52-
return (entry === "any" || entry === "maskable" || entry === "monochrome");
57+
return w3cManifestInfo.content.icons
58+
&& w3cManifestInfo.content.icons[index]
59+
&& w3cManifestInfo.content.icons[index].purpose.split(" ").filter(entry => {
60+
return (entry === "any" || entry === "maskable" || entry === "monochrome");
5361
}).length > 0
5462
}
5563

0 commit comments

Comments
 (0)