Skip to content

Commit

Permalink
✅ Validator rules for amp-vimeo 1.0 (ampproject#34199)
Browse files Browse the repository at this point in the history
  • Loading branch information
alanorozco authored and rochapablo committed Aug 30, 2021
1 parent 56d0594 commit 98207a0
Show file tree
Hide file tree
Showing 3 changed files with 172 additions and 0 deletions.
75 changes: 75 additions & 0 deletions extensions/amp-vimeo/1.0/test/validator-amp-vimeo.html
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>
82 changes: 82 additions & 0 deletions extensions/amp-vimeo/1.0/test/validator-amp-vimeo.out
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>
15 changes: 15 additions & 0 deletions extensions/amp-vimeo/validator-amp-vimeo.protoascii
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,26 @@
# limitations under the license.
#

tags: { # amp-vimeo 1.0
html_format: AMP
tag_name: "SCRIPT"
satisfies: "amp-vimeo 1.0"
excludes: "amp-vimeo 0.1"
extension_spec: {
name: "amp-vimeo"
version_name: "v1.0"
version: "1.0"
}
attr_lists: "common-extension-attrs"
}
tags: { # amp-vimeo
html_format: AMP
tag_name: "SCRIPT"
satisfies: "amp-vimeo 0.1"
excludes: "amp-vimeo 1.0"
extension_spec: {
name: "amp-vimeo"
version_name: "v0.1"
version: "0.1"
version: "latest"
requires_usage: EXEMPTED
Expand Down

0 comments on commit 98207a0

Please sign in to comment.