Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Validator Rollup (ampproject#12999)
* Add an amp-video test that shows which tagspec is picked for errors.

* Revision bump for ampproject#12654

* Revision bump for ampproject#12836

* Make sure the light validator doesn't run amp4ads tests.
  • Loading branch information
Gregable authored and gzgogo committed Jan 26, 2018
1 parent 613274c commit d7f06d4
Show file tree
Hide file tree
Showing 4 changed files with 107 additions and 1 deletion.
50 changes: 50 additions & 0 deletions extensions/amp-video/0.1/test/validator-amp-video.html
@@ -0,0 +1,50 @@
<!--
Copyright 2017 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:
Tests for amp-video tag.
-->
<!doctype html>
<html >
<head>
<meta charset="utf-8">
<link rel="canonical" href="./regular-html-version.html">
<meta name="viewport" content="width=device-width,minimum-scale=1">
<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>
<script async custom-element="amp-video" src="https://cdn.ampproject.org/v0/amp-video-latest.js"></script>
</head>
<body>
<!-- Valid -->
<amp-video controls
width="640"
height="360"
layout="responsive"
poster="images/kitten-playing.png">
<source src="videos/kitten-playing.webm"
type="video/webm" />
<source src="videos/kitten-playing.mp4"
type="video/mp4" />
<div fallback>
<p>This browser does not support the video element.</p>
</div>
</amp-video>

<!-- Invalid: Incorrect attribute value for autoplay -->
<amp-video autoplay=true layout=fill width=300 height=500
loop="1" preload="metadata" controls="controls"></amp-video>
</body>
</html>
55 changes: 55 additions & 0 deletions extensions/amp-video/0.1/test/validator-amp-video.out
@@ -0,0 +1,55 @@
FAIL
| <!--
| Copyright 2017 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:
| Tests for amp-video tag.
| -->
| <!doctype html>
| <html ⚡>
| <head>
| <meta charset="utf-8">
| <link rel="canonical" href="./regular-html-version.html">
| <meta name="viewport" content="width=device-width,minimum-scale=1">
| <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>
| <script async custom-element="amp-video" src="https://cdn.ampproject.org/v0/amp-video-latest.js"></script>
| </head>
| <body>
| <!-- Valid -->
| <amp-video controls
| width="640"
| height="360"
| layout="responsive"
| poster="images/kitten-playing.png">
| <source src="videos/kitten-playing.webm"
| type="video/webm" />
| <source src="videos/kitten-playing.mp4"
| type="video/mp4" />
| <div fallback>
| <p>This browser does not support the video element.</p>
| </div>
| </amp-video>
|
| <!-- Invalid: Incorrect attribute value for autoplay -->
| <amp-video autoplay=true layout=fill width=300 height=500
>> ^~~~~~~~~
amp-video/0.1/test/validator-amp-video.html:47:2 The attribute 'autoplay' in tag 'amp-video' is set to the invalid value 'true'. (see https://www.ampproject.org/docs/reference/components/amp-video) [AMP_TAG_PROBLEM]
>> ^~~~~~~~~
amp-video/0.1/test/validator-amp-video.html:47:2 The attribute 'loop' in tag 'amp-video' is set to the invalid value '1'. (see https://www.ampproject.org/docs/reference/components/amp-video) [AMP_TAG_PROBLEM]
| loop="1" preload="metadata" controls="controls"></amp-video>
| </body>
| </html>
1 change: 1 addition & 0 deletions validator/light/validator-light_test.js
Expand Up @@ -96,6 +96,7 @@ function findHtmlFilesRelativeToTestdata() {
// TODO(gregable): Remove this hack once the js validator knows how
// to validate A4A documents.
if (candidate.match(/^.*.html/g) &&
!candidate.match(/amp4ads/g) &&
!entry.subdir.match(/amp4ads_feature_tests/g)) {
testFiles.push(path.join(entry.subdir, candidate));
}
Expand Down
2 changes: 1 addition & 1 deletion validator/validator-main.protoascii
Expand Up @@ -25,7 +25,7 @@ min_validator_revision_required: 295
# newer versions of the spec file. This is currently a Google internal
# mechanism, validator.js does not use this facility. However, any
# change to this file (validator-main.js) requires updating this revision id.
spec_file_revision: 552
spec_file_revision: 554

styles_spec_url: "https://www.ampproject.org/docs/guides/author-develop/responsive/style_pages"
script_spec_url: "https://www.ampproject.org/docs/reference/spec#html-tags"
Expand Down

0 comments on commit d7f06d4

Please sign in to comment.