Skip to content
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 Rollup #9719

Merged
merged 3 commits into from
Jun 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions extensions/amp-ad/0.1/validator-amp-ad.protoascii
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ tags: { # <amp-embed>
# many pages don't have it, so it ends up late loaded and we warn, instead
# of making this a validation error.
also_requires_tag_warning: "amp-ad extension .js script"
disallowed_ancestor: "AMP-APP-BANNER"
disallowed_ancestor: "AMP-SIDEBAR"
attrs: { name: "alt" }
attrs: { name: "json" }
Expand Down
36 changes: 36 additions & 0 deletions extensions/amp-imgur/0.1/test/validator-amp-imgur.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<!--
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-imgur 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-imgur" src="https://cdn.ampproject.org/v0/amp-imgur-latest.js"></script>
</head>
<body>
<!-- Valid: Example of amp-imgur usage -->
<amp-imgur data-imgur-id="2CnX7" height="480" width="640" layout="responsive"></amp-imgur>
<!-- Invalid: Missing mandatory data-imgur-id attribute -->
<amp-imgur height="480" width="640" layout="responsive"></amp-imgur>
</body>
</html>
2 changes: 2 additions & 0 deletions extensions/amp-imgur/0.1/test/validator-amp-imgur.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FAIL
amp-imgur/0.1/test/validator-amp-imgur.html:34:2 The mandatory attribute 'data-imgur-id' is missing in tag 'amp-imgur'. (see https://www.ampproject.org/docs/reference/components/amp-imgur) [AMP_TAG_PROBLEM]
11 changes: 7 additions & 4 deletions validator/engine/validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -1712,8 +1712,8 @@ class Context {
this.tagStack_ = new TagStack();

/**
* Maps from the tagspec id to the tagspec id.
* @type {!Array<?>}
* Set of tagSpec ids that have been validated.
* @type {!Array<boolean>}
* @private
*/
this.tagspecsValidated_ = [];
Expand Down Expand Up @@ -1838,13 +1838,16 @@ class Context {
recordTagspecValidated(tagSpecId) {
const duplicate = this.tagspecsValidated_.hasOwnProperty(tagSpecId);
if (!duplicate) {
this.tagspecsValidated_[tagSpecId] = 0;
this.tagspecsValidated_[tagSpecId] = true;
}
return !duplicate;
}

/**
* @return {!Array<?>}
* Returns the tag spec ids that have been validated. The return object
* should be treated as a set (the object keys), and the value should be
* ignored.
* @return {!Array<boolean>}
*/
getTagspecsValidated() {
return this.tagspecsValidated_;
Expand Down
2 changes: 1 addition & 1 deletion validator/validator-main.protoascii
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ min_validator_revision_required: 232
# 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: 425
spec_file_revision: 427

styles_spec_url: "https://www.ampproject.org/docs/guides/author-develop/responsive/style_pages"

Expand Down