-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✅ Validator rules for amp-vimeo 1.0 #34199
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
<!-- | ||
Copyright 2021 The AMP HTML 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. | ||
--> | ||
<!-- | ||
Test Description: | ||
This tests validation for the amp-vimeo tag version 1.0. | ||
--> | ||
<!DOCTYPE html> | ||
<html ⚡> | ||
<!-- prettier-ignore --> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>amp-vimeo 1.0</title> | ||
<link rel="canonical" href="./"> | ||
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"> | ||
<link href="https://fonts.googleapis.com/css?family=Questrial" rel="stylesheet" type="text/css"> | ||
<script async custom-element="amp-vimeo" src="https://cdn.ampproject.org/v0/amp-vimeo-1.0.js"></script> | ||
<style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript> | ||
<script async src="https://cdn.ampproject.org/v0.js"></script> | ||
</head> | ||
<body> | ||
<!-- valid --> | ||
<amp-vimeo data-videoid="27246366" width="500" height="281"></amp-vimeo> | ||
|
||
<!-- valid --> | ||
<amp-vimeo | ||
data-videoid="27246366" | ||
width="500" | ||
height="281" | ||
layout="responsive" | ||
noloading | ||
autoplay | ||
></amp-vimeo> | ||
|
||
<!-- valid --> | ||
<amp-vimeo | ||
data-videoid="27246366" | ||
width="500" | ||
height="281" | ||
layout="responsive" | ||
noloading="noloading" | ||
></amp-vimeo> | ||
|
||
<!-- invalid: bad videoid --> | ||
<amp-vimeo | ||
data-videoid="i don't think so" | ||
width="500" | ||
height="281" | ||
layout="responsive" | ||
></amp-vimeo> | ||
|
||
<!-- invalid: videoid missing --> | ||
<amp-vimeo width="500" height="281" layout="responsive"></amp-vimeo> | ||
|
||
<!-- invalid: noloading must not have a value other than "" or noloading --> | ||
<amp-vimeo | ||
width="500" | ||
height="281" | ||
layout="responsive" | ||
noloading="foo" | ||
></amp-vimeo> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
FAIL | ||
| <!-- | ||
| Copyright 2021 The AMP HTML 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. | ||
| --> | ||
| <!-- | ||
| Test Description: | ||
| This tests validation for the amp-vimeo tag version 1.0. | ||
| --> | ||
| <!DOCTYPE html> | ||
| <html ⚡> | ||
| <!-- prettier-ignore --> | ||
| <head> | ||
| <meta charset="utf-8"> | ||
| <title>amp-vimeo 1.0</title> | ||
| <link rel="canonical" href="./"> | ||
| <meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"> | ||
| <link href="https://fonts.googleapis.com/css?family=Questrial" rel="stylesheet" type="text/css"> | ||
| <script async custom-element="amp-vimeo" src="https://cdn.ampproject.org/v0/amp-vimeo-1.0.js"></script> | ||
| <style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript> | ||
| <script async src="https://cdn.ampproject.org/v0.js"></script> | ||
| </head> | ||
| <body> | ||
| <!-- valid --> | ||
| <amp-vimeo data-videoid="27246366" width="500" height="281"></amp-vimeo> | ||
| | ||
| <!-- valid --> | ||
| <amp-vimeo | ||
| data-videoid="27246366" | ||
| width="500" | ||
| height="281" | ||
| layout="responsive" | ||
| noloading | ||
| autoplay | ||
| ></amp-vimeo> | ||
| | ||
| <!-- valid --> | ||
| <amp-vimeo | ||
| data-videoid="27246366" | ||
| width="500" | ||
| height="281" | ||
| layout="responsive" | ||
| noloading="noloading" | ||
| ></amp-vimeo> | ||
| | ||
| <!-- invalid: bad videoid --> | ||
| <amp-vimeo | ||
>> ^~~~~~~~~ | ||
amp-vimeo/1.0/test/validator-amp-vimeo.html:57:4 The attribute 'data-videoid' in tag 'amp-vimeo' is set to the invalid value 'i don't think so'. (see https://amp.dev/documentation/components/amp-vimeo) | ||
| data-videoid="i don't think so" | ||
| width="500" | ||
| height="281" | ||
| layout="responsive" | ||
| ></amp-vimeo> | ||
| | ||
| <!-- invalid: videoid missing --> | ||
| <amp-vimeo width="500" height="281" layout="responsive"></amp-vimeo> | ||
>> ^~~~~~~~~ | ||
amp-vimeo/1.0/test/validator-amp-vimeo.html:65:4 The mandatory attribute 'data-videoid' is missing in tag 'amp-vimeo'. (see https://amp.dev/documentation/components/amp-vimeo) | ||
| | ||
| <!-- invalid: noloading must not have a value other than "" or noloading --> | ||
| <amp-vimeo | ||
>> ^~~~~~~~~ | ||
amp-vimeo/1.0/test/validator-amp-vimeo.html:68:4 The attribute 'noloading' in tag 'amp-vimeo' is set to the invalid value 'foo'. (see https://amp.dev/documentation/components/amp-vimeo) | ||
| width="500" | ||
| height="281" | ||
| layout="responsive" | ||
| noloading="foo" | ||
| ></amp-vimeo> | ||
| </body> | ||
| </html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you add a test for the satisfies/excludes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How would that work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd imagine it would be one with both script tags, though it may issue a different error. What is being achieved by having satisifes/excludes here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two script tags should throw the error for this satisfies/excludes. For context the satisfies/excludes was added from a somewhat recent change to validator here: https://critique-ng.corp.google.com/cl/366894452
This allows us to specify different extension_spec rules between different versions of the script. So in this case
1.0
does not have the following:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't get the following to fail, in either order:
Could there be a problem with the definition that prevents this from erroring out?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The definition looks right, I also tried producing locally and also not able to get it to fail. I will check with the Validator team.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Kevin. As discussed offline, the error is not being triggered in any case. Since that's being handled separately, I'll merge as-is.