Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨amp-inline-gallery docs and validation rules (#26708)
- Add docs for amp-inline-gallery elements and linking to amp-base-carousel for its usage. - Add validation rules for amp-inline-gallery elements. - Fix selector for finding the amp-base-carousel, when it is a direct child of the amp-inline-gallery.
- Loading branch information
1 parent
da1fb54
commit e3be1b2
Showing
7 changed files
with
688 additions
and
1 deletion.
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
57 changes: 57 additions & 0 deletions
57
extensions/amp-inline-gallery/0.1/test/validator-amp-inline-gallery-pagination.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,57 @@ | ||
<!-- | ||
Copyright 2020 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 the amp-inline-gallery-pagination tag. See the inline comments. | ||
--> | ||
<!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-inline-gallery" src="https://cdn.ampproject.org/v0/amp-inline-gallery-0.1.js"></script> | ||
</head> | ||
<body> | ||
<!-- Invalid: Not in a gallery --> | ||
<amp-inline-gallery-pagination layout="fixed-height" height="24"> | ||
</amp-inline-gallery-pagination> | ||
<!-- Invalid: Inset without nodisplay --> | ||
<amp-inline-gallery layout="container"> | ||
<amp-inline-gallery-pagination layout="fixed-height" height="24" inset> | ||
</amp-inline-gallery-pagination> | ||
</amp-inline-gallery> | ||
<!-- Valid: Inset with nodisplay --> | ||
<amp-inline-gallery layout="container"> | ||
<amp-inline-gallery-pagination layout="nodisplay" inset> | ||
</amp-inline-gallery-pagination> | ||
</amp-inline-gallery> | ||
<!-- Valid: Wrapped with a parent div --> | ||
<amp-inline-gallery layout="container"> | ||
<div> | ||
<amp-inline-gallery-pagination layout="nodisplay"inset> | ||
</amp-inline-gallery-pagination> | ||
</div> | ||
</amp-inline-gallery> | ||
<!-- Valid: Non-inset with fixed-height --> | ||
<amp-inline-gallery layout="container"> | ||
<amp-inline-gallery-pagination layout="fixed-height" height="24"> | ||
</amp-inline-gallery-pagination> | ||
</amp-inline-gallery> | ||
</body> | ||
</html> |
62 changes: 62 additions & 0 deletions
62
extensions/amp-inline-gallery/0.1/test/validator-amp-inline-gallery-pagination.out
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,62 @@ | ||
FAIL | ||
| <!-- | ||
| Copyright 2020 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 the amp-inline-gallery-pagination tag. See the inline comments. | ||
| --> | ||
| <!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-inline-gallery" src="https://cdn.ampproject.org/v0/amp-inline-gallery-0.1.js"></script> | ||
| </head> | ||
| <body> | ||
| <!-- Invalid: Not in a gallery --> | ||
| <amp-inline-gallery-pagination layout="fixed-height" height="24"> | ||
>> ^~~~~~~~~ | ||
amp-inline-gallery/0.1/test/validator-amp-inline-gallery-pagination.html:32:2 The tag 'amp-inline-gallery-pagination' may only appear as a descendant of tag 'amp-inline-gallery'. (see https://amp.dev/documentation/components/amp-inline-gallery) | ||
| </amp-inline-gallery-pagination> | ||
| <!-- Invalid: Inset without nodisplay --> | ||
| <amp-inline-gallery layout="container"> | ||
| <amp-inline-gallery-pagination layout="fixed-height" height="24" inset> | ||
>> ^~~~~~~~~ | ||
amp-inline-gallery/0.1/test/validator-amp-inline-gallery-pagination.html:36:4 The specified layout 'FIXED_HEIGHT' is not supported by tag 'amp-inline-gallery-pagination [inset]'. (see https://amp.dev/documentation/components/amp-inline-gallery) | ||
| </amp-inline-gallery-pagination> | ||
| </amp-inline-gallery> | ||
| <!-- Valid: Inset with nodisplay --> | ||
| <amp-inline-gallery layout="container"> | ||
| <amp-inline-gallery-pagination layout="nodisplay" inset> | ||
| </amp-inline-gallery-pagination> | ||
| </amp-inline-gallery> | ||
| <!-- Valid: Wrapped with a parent div --> | ||
| <amp-inline-gallery layout="container"> | ||
| <div> | ||
| <amp-inline-gallery-pagination layout="nodisplay"inset> | ||
| </amp-inline-gallery-pagination> | ||
| </div> | ||
| </amp-inline-gallery> | ||
| <!-- Valid: Non-inset with fixed-height --> | ||
| <amp-inline-gallery layout="container"> | ||
| <amp-inline-gallery-pagination layout="fixed-height" height="24"> | ||
| </amp-inline-gallery-pagination> | ||
| </amp-inline-gallery> | ||
| </body> | ||
| </html> |
77 changes: 77 additions & 0 deletions
77
extensions/amp-inline-gallery/0.1/test/validator-amp-inline-gallery-thumbnails.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,77 @@ | ||
<!-- | ||
Copyright 2020 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 the amp-inline-gallery-thumbnails tag. See the inline comments. | ||
--> | ||
<!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-inline-gallery" src="https://cdn.ampproject.org/v0/amp-inline-gallery-0.1.js"></script> | ||
</head> | ||
<body> | ||
<!-- Invalid: Not in a gallery --> | ||
<amp-inline-gallery-thumbnails layout="fixed-height" height="96"> | ||
</amp-inline-gallery-thumbnails> | ||
<!-- Invalid: Aspect ratio height widthout width --> | ||
<amp-inline-gallery layout="container"> | ||
<amp-inline-gallery-thumbnails layout="fixed-height" height="96" aspect-ratio-height="2"> | ||
</amp-inline-gallery-thumbnails> | ||
</amp-inline-gallery> | ||
<!-- Invalid: Non-number aspect ratio height--> | ||
<amp-inline-gallery layout="container"> | ||
<amp-inline-gallery-thumbnails layout="fixed-height" height="96" aspect-ratio-height="two" aspect-ratio-width="3"> | ||
</amp-inline-gallery-thumbnails> | ||
</amp-inline-gallery> | ||
<!-- Invalid: Aspect ratio component of zero --> | ||
<amp-inline-gallery layout="container"> | ||
<amp-inline-gallery-thumbnails layout="fixed-height" height="96" aspect-ratio-height="0" aspect-ratio-width="3"> | ||
</amp-inline-gallery-thumbnails> | ||
</amp-inline-gallery> | ||
<!-- Invalid: Aspect ratio component of zero (float) --> | ||
<amp-inline-gallery layout="container"> | ||
<amp-inline-gallery-thumbnails layout="fixed-height" height="96" aspect-ratio-height="0.00" aspect-ratio-width="3"> | ||
</amp-inline-gallery-thumbnails> | ||
</amp-inline-gallery> | ||
<!-- Invalid: Loop attribute without value --> | ||
<amp-inline-gallery layout="container"> | ||
<amp-inline-gallery-thumbnails layout="fixed-height" height="96" loop> | ||
</amp-inline-gallery-thumbnails> | ||
</amp-inline-gallery> | ||
<!-- Valid: Wrapped with a parent div --> | ||
<amp-inline-gallery layout="container"> | ||
<div> | ||
<amp-inline-gallery-thumbnails layout="fixed-height" height="96"> | ||
</amp-inline-gallery-thumbnails> | ||
</div> | ||
</amp-inline-gallery> | ||
<!-- Valid: Aspect ratio specified --> | ||
<amp-inline-gallery layout="container"> | ||
<amp-inline-gallery-thumbnails layout="fixed-height" height="96" aspect-ratio-height="2.0" aspect-ratio-width="3"> | ||
</amp-inline-gallery-thumbnails> | ||
</amp-inline-gallery> | ||
<!-- Valid: Loop attribute specified --> | ||
<amp-inline-gallery layout="container"> | ||
<amp-inline-gallery-thumbnails layout="fixed-height" height="96" loop="true"> | ||
</amp-inline-gallery-thumbnails> | ||
</amp-inline-gallery> | ||
</body> | ||
</html> |
90 changes: 90 additions & 0 deletions
90
extensions/amp-inline-gallery/0.1/test/validator-amp-inline-gallery-thumbnails.out
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,90 @@ | ||
FAIL | ||
| <!-- | ||
| Copyright 2020 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 the amp-inline-gallery-thumbnails tag. See the inline comments. | ||
| --> | ||
| <!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-inline-gallery" src="https://cdn.ampproject.org/v0/amp-inline-gallery-0.1.js"></script> | ||
| </head> | ||
| <body> | ||
| <!-- Invalid: Not in a gallery --> | ||
| <amp-inline-gallery-thumbnails layout="fixed-height" height="96"> | ||
>> ^~~~~~~~~ | ||
amp-inline-gallery/0.1/test/validator-amp-inline-gallery-thumbnails.html:32:2 The tag 'amp-inline-gallery-thumbnails' may only appear as a descendant of tag 'amp-inline-gallery'. (see https://amp.dev/documentation/components/amp-inline-gallery) | ||
| </amp-inline-gallery-thumbnails> | ||
| <!-- Invalid: Aspect ratio height widthout width --> | ||
| <amp-inline-gallery layout="container"> | ||
| <amp-inline-gallery-thumbnails layout="fixed-height" height="96" aspect-ratio-height="2"> | ||
>> ^~~~~~~~~ | ||
amp-inline-gallery/0.1/test/validator-amp-inline-gallery-thumbnails.html:36:4 The attribute 'aspect-ratio-width' in tag 'amp-inline-gallery-thumbnails' is missing or incorrect, but required by attribute 'aspect-ratio-height'. (see https://amp.dev/documentation/components/amp-inline-gallery) | ||
| </amp-inline-gallery-thumbnails> | ||
| </amp-inline-gallery> | ||
| <!-- Invalid: Non-number aspect ratio height--> | ||
| <amp-inline-gallery layout="container"> | ||
| <amp-inline-gallery-thumbnails layout="fixed-height" height="96" aspect-ratio-height="two" aspect-ratio-width="3"> | ||
>> ^~~~~~~~~ | ||
amp-inline-gallery/0.1/test/validator-amp-inline-gallery-thumbnails.html:41:4 The attribute 'aspect-ratio-height' in tag 'amp-inline-gallery-thumbnails' is set to the invalid value 'two'. (see https://amp.dev/documentation/components/amp-inline-gallery) | ||
| </amp-inline-gallery-thumbnails> | ||
| </amp-inline-gallery> | ||
| <!-- Invalid: Aspect ratio component of zero --> | ||
| <amp-inline-gallery layout="container"> | ||
| <amp-inline-gallery-thumbnails layout="fixed-height" height="96" aspect-ratio-height="0" aspect-ratio-width="3"> | ||
>> ^~~~~~~~~ | ||
amp-inline-gallery/0.1/test/validator-amp-inline-gallery-thumbnails.html:46:4 The attribute 'aspect-ratio-height' in tag 'amp-inline-gallery-thumbnails' is set to the invalid value '0'. (see https://amp.dev/documentation/components/amp-inline-gallery) | ||
| </amp-inline-gallery-thumbnails> | ||
| </amp-inline-gallery> | ||
| <!-- Invalid: Aspect ratio component of zero (float) --> | ||
| <amp-inline-gallery layout="container"> | ||
| <amp-inline-gallery-thumbnails layout="fixed-height" height="96" aspect-ratio-height="0.00" aspect-ratio-width="3"> | ||
>> ^~~~~~~~~ | ||
amp-inline-gallery/0.1/test/validator-amp-inline-gallery-thumbnails.html:51:4 The attribute 'aspect-ratio-height' in tag 'amp-inline-gallery-thumbnails' is set to the invalid value '0.00'. (see https://amp.dev/documentation/components/amp-inline-gallery) | ||
| </amp-inline-gallery-thumbnails> | ||
| </amp-inline-gallery> | ||
| <!-- Invalid: Loop attribute without value --> | ||
| <amp-inline-gallery layout="container"> | ||
| <amp-inline-gallery-thumbnails layout="fixed-height" height="96" loop> | ||
>> ^~~~~~~~~ | ||
amp-inline-gallery/0.1/test/validator-amp-inline-gallery-thumbnails.html:56:4 The attribute 'loop' in tag 'amp-inline-gallery-thumbnails' is set to the invalid value ''. (see https://amp.dev/documentation/components/amp-inline-gallery) | ||
| </amp-inline-gallery-thumbnails> | ||
| </amp-inline-gallery> | ||
| <!-- Valid: Wrapped with a parent div --> | ||
| <amp-inline-gallery layout="container"> | ||
| <div> | ||
| <amp-inline-gallery-thumbnails layout="fixed-height" height="96"> | ||
| </amp-inline-gallery-thumbnails> | ||
| </div> | ||
| </amp-inline-gallery> | ||
| <!-- Valid: Aspect ratio specified --> | ||
| <amp-inline-gallery layout="container"> | ||
| <amp-inline-gallery-thumbnails layout="fixed-height" height="96" aspect-ratio-height="2.0" aspect-ratio-width="3"> | ||
| </amp-inline-gallery-thumbnails> | ||
| </amp-inline-gallery> | ||
| <!-- Valid: Loop attribute specified --> | ||
| <amp-inline-gallery layout="container"> | ||
| <amp-inline-gallery-thumbnails layout="fixed-height" height="96" loop="true"> | ||
| </amp-inline-gallery-thumbnails> | ||
| </amp-inline-gallery> | ||
| </body> | ||
| </html> |
Oops, something went wrong.