Skip to content

Commit

Permalink
Merge pull request #8 from mydea/icon-attributes
Browse files Browse the repository at this point in the history
Allow `purpose` member on `icons`
  • Loading branch information
san650 authored Oct 6, 2020
2 parents 1ae2162 + cc08823 commit c501e92
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ function validateImages(manifest, memberName, itemName, errors) {

newErrors = validateString(item, 'type', newErrors, { memberPrefix: itemName });

errors = validateKnownProperties(itemName, item, ['src', 'sizes', 'type'], errors);
errors = validateKnownProperties(itemName, item, ['src', 'sizes', 'type', 'purpose'], errors);
});
}
}
Expand Down
15 changes: 15 additions & 0 deletions tests/index-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,21 @@ describe('validate', function() {
assert.deepEqual(validate(manifest), EMPTY);
});

it('is valid when element has purpose' , function() {
var manifest = {
icons: [
{
src: "icon/lowres.webp",
sizes: "16x16 32x32 48x48",
type: "image/webp",
purpose: "any"
}
]
};

assert.deepEqual(validate(manifest), EMPTY);
});

it('validates src exists for every icon', function() {
var manifest = {
icons: [
Expand Down

0 comments on commit c501e92

Please sign in to comment.