From c10893569735dad34d56c90712904d5591a08866 Mon Sep 17 00:00:00 2001 From: Cathy Zhu Date: Thu, 27 Dec 2018 14:12:43 -0800 Subject: [PATCH] Add validation for amp-list children attributes --- .../amp-list/0.1/test/validator-amp-list.html | 16 ++++++++ .../amp-list/0.1/test/validator-amp-list.out | 38 +++++++++++++++---- .../amp-list/validator-amp-list.protoascii | 27 +++++++++++++ 3 files changed, 74 insertions(+), 7 deletions(-) diff --git a/extensions/amp-list/0.1/test/validator-amp-list.html b/extensions/amp-list/0.1/test/validator-amp-list.html index 63fbd1bfa7f13..25d1b0a79f7dc 100644 --- a/extensions/amp-list/0.1/test/validator-amp-list.html +++ b/extensions/amp-list/0.1/test/validator-amp-list.html @@ -102,6 +102,17 @@ load-more="manual" load-more-bookmark="next"> + + +
+
+
+
+
+ + +
+
+
+
diff --git a/extensions/amp-list/0.1/test/validator-amp-list.out b/extensions/amp-list/0.1/test/validator-amp-list.out index fa5b577bcc1b9..83e59a40550dd 100644 --- a/extensions/amp-list/0.1/test/validator-amp-list.out +++ b/extensions/amp-list/0.1/test/validator-amp-list.out @@ -107,10 +107,21 @@ amp-list/0.1/test/validator-amp-list.html:85:2 The attribute 'auto-resize' in ta | load-more="manual" | load-more-bookmark="next"> | +| +| +|
+|
+|
+|
+|
+| | | > ^~~~~~~~~ -amp-list/0.1/test/validator-amp-list.html:106:2 The attribute 'binding' in tag 'amp-list' is set to the invalid value 'this-is-an-error'. (see https://www.ampproject.org/docs/reference/components/amp-list) [DISALLOWED_HTML] +amp-list/0.1/test/validator-amp-list.html:117:2 The attribute 'binding' in tag 'amp-list' is set to the invalid value 'this-is-an-error'. (see https://www.ampproject.org/docs/reference/components/amp-list) [DISALLOWED_HTML] | src="https://data.com/articles.json?ref=CANONICAL_URL" | binding="this-is-an-error"> |
@@ -118,37 +129,50 @@ amp-list/0.1/test/validator-amp-list.html:106:2 The attribute 'binding' in tag ' | | > ^~~~~~~~~ -amp-list/0.1/test/validator-amp-list.html:112:2 The attribute 'wdith' may not appear in tag 'amp-list'. (see https://www.ampproject.org/docs/reference/components/amp-list) [DISALLOWED_HTML] +amp-list/0.1/test/validator-amp-list.html:123:2 The attribute 'wdith' may not appear in tag 'amp-list'. (see https://www.ampproject.org/docs/reference/components/amp-list) [DISALLOWED_HTML] | wdith=10 height=10> |
|
| | >> ^~~~~~~~~ -amp-list/0.1/test/validator-amp-list.html:117:2 The tag 'amp-list' is missing a mandatory attribute - pick at least one of ['src','[src]']. (see https://www.ampproject.org/docs/reference/components/amp-list) [AMP_TAG_PROBLEM] +amp-list/0.1/test/validator-amp-list.html:128:2 The tag 'amp-list' is missing a mandatory attribute - pick at least one of ['src','[src]']. (see https://www.ampproject.org/docs/reference/components/amp-list) [AMP_TAG_PROBLEM] |
|
| | >> ^~~~~~~~~ -amp-list/0.1/test/validator-amp-list.html:122:2 Incomplete layout attributes specified for tag 'amp-list'. For example, provide attributes 'width' and 'height'. (see https://www.ampproject.org/docs/reference/components/amp-list) [AMP_LAYOUT_PROBLEM] +amp-list/0.1/test/validator-amp-list.html:133:2 Incomplete layout attributes specified for tag 'amp-list'. For example, provide attributes 'width' and 'height'. (see https://www.ampproject.org/docs/reference/components/amp-list) [AMP_LAYOUT_PROBLEM] |
|
| | > ^~~~~~~~~ -amp-list/0.1/test/validator-amp-list.html:126:2 The attribute 'load-more' in tag 'amp-list' is set to the invalid value ''. (see https://www.ampproject.org/docs/reference/components/amp-list) [DISALLOWED_HTML] +amp-list/0.1/test/validator-amp-list.html:137:2 The attribute 'load-more' in tag 'amp-list' is set to the invalid value ''. (see https://www.ampproject.org/docs/reference/components/amp-list) [DISALLOWED_HTML] | src="https://data.com/articles.json?ref=CANONICAL_URL" | load-more> |
-| +| | > ^~~~~~~~~ -amp-list/0.1/test/validator-amp-list.html:131:2 The attribute 'load-more' in tag 'amp-list' is set to the invalid value 'gibberish'. (see https://www.ampproject.org/docs/reference/components/amp-list) [DISALLOWED_HTML] +amp-list/0.1/test/validator-amp-list.html:142:2 The attribute 'load-more' in tag 'amp-list' is set to the invalid value 'gibberish'. (see https://www.ampproject.org/docs/reference/components/amp-list) [DISALLOWED_HTML] | src="https://data.com/articles.json?ref=CANONICAL_URL" | load-more="gibberish" | load-more-bookmark="next"> | +| +|
+>> ^~~~~~~~~ +amp-list/0.1/test/validator-amp-list.html:148:2 The attribute 'load-more-button' may not appear in tag 'div'. [DISALLOWED_HTML] +|
+>> ^~~~~~~~~ +amp-list/0.1/test/validator-amp-list.html:149:2 The attribute 'load-more-loading' may not appear in tag 'div'. [DISALLOWED_HTML] +|
+>> ^~~~~~~~~ +amp-list/0.1/test/validator-amp-list.html:150:2 The attribute 'load-more-failed' may not appear in tag 'div'. [DISALLOWED_HTML] +|
+>> ^~~~~~~~~ +amp-list/0.1/test/validator-amp-list.html:151:2 The attribute 'load-more-end' may not appear in tag 'div'. [DISALLOWED_HTML] | | \ No newline at end of file diff --git a/extensions/amp-list/validator-amp-list.protoascii b/extensions/amp-list/validator-amp-list.protoascii index e1a03f95cd525..f96ef3c8d3813 100644 --- a/extensions/amp-list/validator-amp-list.protoascii +++ b/extensions/amp-list/validator-amp-list.protoascii @@ -105,6 +105,33 @@ tags: { # with mandatory src and/or [src] attr supported_layouts: RESPONSIVE } } +tags: { # amp-list load-more children + html_format: AMP + spec_name: "AMP-LIST LOAD-MORE CHILDREN" + tag_name: "DIV" + mandatory_parent: "AMP-LIST" + attrs: { + name: "load-more-button" + value: "" + mandatory_oneof: "['load-more-button', 'load-more-failed', 'load-more-end', 'load-more-loading']" + } + attrs: { + name: "load-more-failed" + value: "" + mandatory_oneof: "['load-more-button', 'load-more-failed', 'load-more-end', 'load-more-loading']" + } + attrs: { + name: "load-more-loading" + value: "" + mandatory_oneof: "['load-more-button', 'load-more-failed', 'load-more-end', 'load-more-loading']" + + } + attrs: { + name: "load-more-end" + value: "" + mandatory_oneof: "['load-more-button', 'load-more-failed', 'load-more-end', 'load-more-loading']" + } +} # AMP4EMAIL disallows mustache in src attribute. tags: { # html_format: AMP4EMAIL